[Teneo] Switch to DB2 and not getting identity columns [message #619149] |
Mon, 02 June 2008 16:18 |
David Wynter Messages: 4624 Registered: July 2009 |
Senior Member |
|
|
Hi,
I was successfully generating a schema on MySQL and getting the auto
increment on the id primary key column. I switched to DB2 dialect and if
I leave the primary key as e_id I do get IDENTITY columns but when I use
id in the model with the annotation I do not get them. Am I missing
something?
Here are my properties
props.setProperty(Environment.DRIVER, "com.ibm.db2.jcc.DB2Driver");
props.setProperty(Environment.USER, "Administrator");
props.setProperty(Environment.PASS, "e*****");
props.setProperty(Environment.URL, "jdbc:db2://192.168.0.3:50000/"
+ dbName);
props.setProperty(Environment.DIALECT,
org.hibernate.dialect.DB2Dialect.class.getName());
props.setProperty(PersistenceOptions.MAXIMUM_SQL_NAME_LENGTH ,
"30");
props.setProperty(PersistenceOptions.ID_FEATURE_AS_PRIMARY_K EY,
"true");
props.setProperty(PersistenceOptions.DEFAULT_ID_FEATURE_NAME ,
"id");
props.setProperty(PersistenceOptions.JOIN_COLUMN_NAMING_STRA TEGY, "simple");
props.setProperty(PersistenceOptions.ALSO_MAP_AS_CLASS, "false");
props.setProperty(PersistenceOptions.DEFAULT_TEMPORAL_VALUE,
"DATE");
props.setProperty(PersistenceOptions.DISABLE_ECONTAINER_MAPP ING, "true");
props.setProperty(PersistenceOptions.ALWAYS_VERSION, "false");
props.setProperty(PersistenceOptions.ALWAYS_MAP_LIST_AS_BAG,
"true");
props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
"JOINED");
Here is a sample of the XSD
<xsd:complexType name="Tranche">
<xsd:sequence minOccurs="0" maxOccurs="1">
<xsd:element ref="gensec:source" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:int">
<xsd:annotation>
<xsd:appinfo source="teneo.jpa">@Id</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute
default="http://www.mddl.org/mddl/scheme/trancheIDType.xml"
name="scheme" use="optional" />
<xsd:attribute name="nameRef" type="xsd:anyURI" />
<xsd:attribute default="valid" name="validity"
type="gensec:QualityEnumeration" use="optional" />
<xsd:attribute name="rank" type="xsd:int" />
</xsd:complexType>
<xsd:element name="tranche" type="gensec:Tranche" />
Thx,
David
|
|
|
Powered by
FUDForum. Page generated in 0.03063 seconds