Here's what I've done:
repository.xml Excerpts: ================================
<sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerMySQLImpl"/>
<class-descriptor class="com.nml.dove.event.EventVO" table="event"> <field-descriptor name="id" column="ID" jdbc-type="BIGINT" primarykey="true" autoincrement="true"/>
.....
</class-descriptor> ================================================
In mySQL Database: ================================================ ID bigint(20) unsigned not null auto_increment, PRIMARY KEY ('ID') ================================================
When I execute the store command, the record is inserted correctly, but I get an error in the afterStore() method:
[org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl]
ERROR: while set field:
object class[ com.nml.dove.event.EventVO
target field: id
target field type: class java.lang.Long
object value class: java.lang.Integer
object value: 3]
[org.apache.ojb.broker.core.PersistenceBrokerImpl]
ERROR: SQLException during SequenceManager.afterStore (for a com.nml.dove.event.EventVO):
Error setting field:id in object:com.nml.dove.event.EventVO
Error setting field:id in object:com.nml.dove.event.EventVO
I am submitting the EventVO object to OJB (Persistence Broker API) with all fields except ID populated. I am sending ID as a null value. Because I am using an auto_increment column in mySQL, I want to store() the record without an ID.
One clue to this problem is the target field type/object value class discrepancy above:
target field type: class java.lang.Long object value class: java.lang.Integer
I have no idea where the Integer is coming from. My mySQL column is a mediumint, which should correspond to a java Long, right? I have tried changing the database table to a bigint with no luck.
It appears that the record goes into the database just fine, but that OJB is trying to update my ValueObject (EventVO) ID column with an Integer instead of a long.
Is this is bug? Is something wrong with my code?
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]