-
1. Re: Autogenerated PK and Transactions
aloubyansky Feb 5, 2003 5:58 AM (in response to milasx)ClassCastException...
What is the type of MDSId?
What is the type of the value generated by the db?
How the MDSId is mapped? -
2. Re: Autogenerated PK and Transactions
milasx Feb 5, 2003 8:56 AM (in response to milasx)Thanks Alex,
I see what you are saying but ...
mDSId is Long and the identity column (mDSId) is NUMERIC (8). In my standardjbosscmp the mapping is:
<java-type>java.lang.Long</java-type>
<jdbc-type>NUMERIC</jdbc-type>
<sql-type>NUMERIC(38,0)</sql-type>
.
I also tried to add on my jbosscmp-jdbc.xml
<field-name>mDSId</field-name>
<column-name>MV_MDS_ID</column-name>
<jdbc-type>NUMERIC</jdbc-type>
<sql-type>NUMERIC(8)</sql-type>
but get a nasty warning @ deploy time:
13:46:08,123 WARN [JDBCMappingMetaData] Unrecognized jdbc-type: type type="NUMERIC", using Types.OTHER
java.lang.NoSuchFieldException: type type="NUMERIC"
at java.lang.Class.getField0(Class.java:1735)
at java.lang.Class.getField(Class.java:900)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCMappingMetaData.getJdbcTypeFromName(JDBCMappingMetaData.java:41)
Any idea?
Simone -
3. Re: Autogenerated PK and Transactions
milasx Feb 5, 2003 10:02 AM (in response to milasx)Hi Alex,
Apologies, forget the part about the last Exception, that was a typo in my XDoclet tags.
*@jboss.sql-type type type="NUMERIC"
Oooops :) Thanks to your hint I also solved the issue of the ClassCastException! The problem was on JDBCCreateEntityCommand for Sybase that I made that was doing:
JDBCCMPFieldBridge cmpField = (JDBCCMPFieldBridge)iter.next();
cmpField.setInstanceValue(ctx, pk);
where pk was an Object as opposed to Long. Shall I update the patch I made for Sybase?
Thanks!
Simone -
4. Re: Autogenerated PK and Transactions
aloubyansky Feb 5, 2003 12:31 PM (in response to milasx)Yes, please, update the patch.
I didn't get the exact reason of failure though.
alex -
5. Re: Autogenerated PK and Transactions
milasx Feb 6, 2003 4:23 AM (in response to milasx)cmpField.setInstanceValue(ctx, pk);
pk vas type Object in the plugin code but actually on my bean is declared to be Long therefore the ClassCastException.
I will update the patch.
Simone -
6. Re: Autogenerated PK and Transactions
zampetti Mar 3, 2003 10:39 AM (in response to milasx)I too am working to enable auto-incremented keys in Sybase. Did someone already get this working?
-
7. Re: Autogenerated PK and Transactions
milasx Mar 4, 2003 10:21 AM (in response to milasx)Refer to the patch:
http://sourceforge.net/tracker/index.php?func=detail&aid=676062&group_id=22866&atid=376687
Simone