使用数据库输入主要明细数据的Java表单

时间:2019-03-21 05:47:14

标签: java crud master-detail

在java awt中,我想为oracle数据库中的主详细数据输入创建CRUD表单。 Gatepass主表和Gatepass详细信息表使用pk / fk关系连接到Gatepass编号上。 这是门通票的形式。一张通行证会收到多个物品。格式就像

Gatepass#1接收人:Tariq先生 入场证日期:2019年3月21日

详细信息 商品编号商品名称数量 12把木椅4 13张木桌1

任何人都可以提供一些示例代码。

1 个答案:

答案 0 :(得分:0)

如果您有10个以上的实体并使用Hibernate,则可以尝试由我托管在https://github.com/smart-flex/Djf

上的Desktop Java Forms。

例如,这是来自演示应用程序的两个主从关系的简约定义:

<panel constraint="Center">
    <layout clazz="net.miginfocom.swing.MigLayout">
        <param type="string" value="" />
        <param type="string" value="[0:0, grow 70, fill][0:0, grow 30, fill]" />
        <param type="string" value="[c, pref, fill] 15 [c, 150px] 10 [c, pref!]" />
    </layout>
    <items>
        <grid bindPref="st">
            <cols>
                <int bind="idStreet" title="ID" width="50" enabled="no"
                    noResize="yes" />
                <text bind="streetName" title="Street name" />
            </cols>
        </grid>
        <grid constraint="wrap">
            <cols>
                <text bind="st.buildings.buildingNumber" title="Number" tips="Building number"/>
            </cols>
        </grid>
        <grid noInfoColumn="true" bindPref="ct">
            <cols>
                <int bind="carId" title="ID" width="50" enabled="no"
                    noResize="yes" />
                <text bind="carName" title="Car name" enabled="no" />
            </cols>
        </grid>
        <grid noInfoColumn="true" constraint="wrap">
            <cols>
                <text bind="ct.modelList.modelName" title="Model name" enabled="no" />
            </cols>
        </grid>     
        <oper constraint="span 2"/>
    </items>
</panel>