on 2019 May 10 3:13 PM
i have to implement the following:
create table prac(
a varchar(20),
b varchar(20),
c varchar(20),
constraint ab unique (a,b),
constraint ac unique (a,c)
);
using items.xml. how can i do that?
Hi - you can achieve this as follows:
<itemtype generate="true" code="Prac" jaloclass="org.training.jalo.Prac" autocreate="true">
<deployment table="prac" typecode="22222"/>
<attributes>
<attribute qualifier="code" type="java.lang.String">
<persistence type="property"/>
<modifiers unique="true"/>
</attribute>
<attribute qualifier="a" type="java.lang.String">
<persistence type="property"/>
</attribute>
<attribute qualifier="b" type="java.lang.String">
<persistence type="property"/>
</attribute>
<attribute qualifier="c" type="java.lang.String">
<persistence type="property"/>
</attribute>
</attributes>
<indexes>
<index name="ab" unique="true" replace="true">
<key attribute="a"/>
<key attribute="b"/>
</index>
<index name="ac" unique="true" replace="true">
<key attribute="a"/>
<key attribute="c"/>
</index>
</indexes>
</itemtype>
Now try to import the following ImpExes:
INSERT prac;code[unique=true];a;b;c
;1;a1;b1;c1
INSERT prac;code[unique=true];a;b;c
;2;a1;b2;c2
INSERT prac;code[unique=true];a;b;c
;3;a1;b1;c2
INSERT prac;code[unique=true];a;b;c
;4;a1;b2;c1
The first and second of these ImpExes will pass while the third and fourth will fail.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.