-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Duplicate entries
PostPosted: Tue Mar 01, 2005 9:20 am 
Newbie

Joined: Tue Mar 01, 2005 8:30 am
Posts: 2
Hibernate version: 2.1.8

Hello All,

I am lost in trying to figure out how the following problem with my mapping can be resolved:

If I save a new Net_printer instance hibernate tries to add two rows with the same id in the printer table. I think it has something to do with the subclass and joined-subclass mapping to the same table. However I was unable to figure out how to change the mapping to make hibernate only adding one row in the printer table.

Can this be done at all?

Is this mapping legal? I have read about the impossibility to mix joined-subclass and subclass identifiers in the same class. However this is not true in this case, is it?

Many Thanks
Manuel

Java class hierarchy

IDevice

Device implements IDevice

IPrinter extends IDevice

Net_printer extends Device implements IPrinter


Mapping documents:

//one table for each device type
Device.hbm.xml
<hibernate-mapping package="lanox.core">
<class name="Device"
table="devices" >
<id name="id" column="id" type="long" unsaved-value="0">
<generator class="increment"/>
</id>

<discriminator column="system_oid" type="string"/>

<property name="asset" column="asset" type="long"/>
<property name="serial" column="serial" type="string"/>
<property name="allocation" column="allocation" type="string"/>
<property name="row_insert" column="row_insert" type="timestamp"/>
<property name="row_update" column="row_update" type="timestamp"/>
<property name="invalidate_cnt" column="invalidate_cnt" type="long"/>
<!-- <property name="system_descr" column="system_descr" type="string"/> -->



<component name="base" class="BaseDevice">
<property name="name" column="name" type="string"/>
<property name="dns_name" column="dns_name" type="string"/>
<property name="mac" column="mac" type="string" />
<one-to-one name="snmpParameters" class="SnmpParameters" cascade="all" />
</component>

<one-to-one name="address" class="DeviceIPAddress" cascade="all"/>
</class>
</hibernate-mapping>


DeviceTypes.hbm.xml
<hibernate-mapping package="lanox.core">
<joined-subclass
name="lanox.core.IPrinter"
extends="lanox.core.Device"
table="printer">
<key column="id"/>
</joined-subclass>

</hibernate-mapping>


//only one table for all types of printers
PrinterTypes.hbm.xml


<hibernate-mapping package="lanox.core">


<subclass name="lanox.snmp.implementations.Net_printer"
discriminator-value=".1.3.6.1.4.1.11.2.3.9.1"
extends="lanox.core.IPrinter"/>


</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
BaseDevice base = new BaseDevice();
base.setName("Test");

IPrinter dev = new Net_printer();
dev.setBase(base);



Transaction tx = sess.beginTransaction();
sess.save(dev);
tx.commit();

Full stack trace of any exception that occurs:
13:46:21,747 DEBUG SessionImpl:560 - opened session
13:46:21,763 DEBUG JDBCTransaction:37 - begin
13:46:21,763 DEBUG DriverManagerConnectionProvider:84 - total checked-out connections: 0
13:46:21,763 DEBUG DriverManagerConnectionProvider:90 - using pooled JDBC connection, pool size: 0
13:46:21,763 DEBUG JDBCTransaction:41 - current autocommit status:false
13:46:21,763 DEBUG IncrementGenerator:62 - fetching initial value: select max(id) from devices
13:46:21,856 DEBUG IncrementGenerator:76 - first free id: 1
13:46:21,856 DEBUG SessionImpl:789 - generated identifier: 1
13:46:21,856 DEBUG SessionImpl:836 - saving [lanox.snmp.implementations.Net_printer#1]
13:46:21,856 DEBUG Cascades:497 - processing cascades for: lanox.snmp.implementations.Net_printer
13:46:21,856 DEBUG Cascades:506 - done processing cascades for: lanox.snmp.implementations.Net_printer
13:46:21,872 DEBUG Cascades:497 - processing cascades for: lanox.snmp.implementations.Net_printer
13:46:21,872 DEBUG Cascades:506 - done processing cascades for: lanox.snmp.implementations.Net_printer
13:46:21,872 DEBUG JDBCTransaction:59 - commit
13:46:21,872 DEBUG SessionImpl:2267 - flushing session
13:46:21,888 DEBUG Cascades:497 - processing cascades for: lanox.snmp.implementations.Net_printer
13:46:21,888 DEBUG Cascades:506 - done processing cascades for: lanox.snmp.implementations.Net_printer
13:46:21,888 DEBUG SessionImpl:2467 - Flushing entities and processing referenced collections
13:46:21,903 DEBUG AbstractEntityPersister:282 - lanox.snmp.implementations.Net_printer.row_insert is dirty
13:46:21,919 DEBUG SessionImpl:2561 - Updating entity: [lanox.snmp.implementations.Net_printer#1]
13:46:21,919 DEBUG SessionImpl:2808 - Processing unreferenced collections
13:46:21,919 DEBUG SessionImpl:2822 - Scheduling collection removes/(re)creates/updates
13:46:21,919 DEBUG SessionImpl:2291 - Flushed: 1 insertions, 1 updates, 0 deletions to 1 objects
13:46:21,919 DEBUG SessionImpl:2296 - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
13:46:21,919 DEBUG Printer:75 - listing entities:
13:46:21,997 DEBUG Printer:82 - lanox.snmp.implementations.Net_printer{base=BaseDevice{dns_name=null, snmpParameters=null, name=Test, mac=null}, allocation=null, invalidate_cnt=0, row_insert=2005-03-01 13:46:21, asset=0, row_update=2005-03-01 13:46:21, address=null, id=1, serial=null}
13:46:22,013 DEBUG SessionImpl:2380 - executing flush
13:46:22,013 DEBUG Cache:741 - printer now: 1109681182013
13:46:22,013 DEBUG Cache:742 - printer Creation Time: 1109681182013 Next To Last Access Time: 0
13:46:22,013 DEBUG Cache:744 - printer mostRecentTime: 1109681182013
13:46:22,028 DEBUG Cache:745 - printer Age to Idle: 120000 Age Idled: 0
13:46:22,028 DEBUG Cache:769 - net.sf.hibernate.cache.UpdateTimestampsCache: Is element with key printer expired?: false
13:46:22,028 DEBUG Cache:741 - printer now: 1109681182028
13:46:22,028 DEBUG Cache:742 - printer Creation Time: 1109681182028 Next To Last Access Time: 0
13:46:22,028 DEBUG Cache:744 - printer mostRecentTime: 1109681182028
13:46:22,028 DEBUG Cache:745 - printer Age to Idle: 120000 Age Idled: 0
13:46:22,028 DEBUG Cache:769 - net.sf.hibernate.cache.UpdateTimestampsCache: Is element with key printer expired?: false
13:46:22,028 DEBUG NormalizedEntityPersister:436 - Inserting entity: [lanox.snmp.implementations.Net_printer#1]
13:46:22,028 DEBUG BatcherImpl:204 - about to open: 0 open PreparedStatements, 0 open ResultSets
13:46:22,028 DEBUG SQL:230 - insert into devices (asset, serial, allocation, row_insert, row_update, invalidate_cnt, name, dns_name, mac, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into devices (asset, serial, allocation, row_insert, row_update, invalidate_cnt, name, dns_name, mac, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
13:46:22,044 DEBUG BatcherImpl:253 - preparing statement
13:46:22,044 DEBUG BatcherImpl:204 - about to open: 1 open PreparedStatements, 0 open ResultSets
13:46:22,044 DEBUG SQL:230 - insert into printer (id) values (?)
Hibernate: insert into printer (id) values (?)
13:46:22,044 DEBUG BatcherImpl:253 - preparing statement
13:46:22,044 DEBUG BatcherImpl:204 - about to open: 2 open PreparedStatements, 0 open ResultSets
13:46:22,044 DEBUG SQL:230 - insert into printer (id) values (?)
Hibernate: insert into printer (id) values (?)
13:46:22,044 DEBUG BatcherImpl:253 - preparing statement
13:46:22,044 DEBUG NormalizedEntityPersister:348 - Dehydrating entity: [lanox.snmp.implementations.Net_printer#1]
13:46:22,060 DEBUG LongType:46 - binding '0' to parameter: 1
13:46:22,060 DEBUG StringType:41 - binding null to parameter: 2
13:46:22,060 DEBUG StringType:41 - binding null to parameter: 3
13:46:22,060 DEBUG TimestampType:41 - binding null to parameter: 4
13:46:22,060 DEBUG TimestampType:41 - binding null to parameter: 5
13:46:22,060 DEBUG LongType:46 - binding '0' to parameter: 6
13:46:22,060 DEBUG StringType:46 - binding 'Test' to parameter: 7
13:46:22,060 DEBUG StringType:41 - binding null to parameter: 8
13:46:22,060 DEBUG StringType:41 - binding null to parameter: 9
13:46:22,075 DEBUG LongType:46 - binding '1' to parameter: 10
13:46:22,075 DEBUG LongType:46 - binding '1' to parameter: 1
13:46:22,075 DEBUG LongType:46 - binding '1' to parameter: 1
13:46:22,185 DEBUG BatcherImpl:211 - done closing: 2 open PreparedStatements, 0 open ResultSets
13:46:22,185 DEBUG BatcherImpl:275 - closing statement
13:46:22,185 DEBUG BatcherImpl:211 - done closing: 1 open PreparedStatements, 0 open ResultSets
13:46:22,185 DEBUG BatcherImpl:275 - closing statement
13:46:22,185 DEBUG BatcherImpl:211 - done closing: 0 open PreparedStatements, 0 open ResultSets
13:46:22,185 DEBUG BatcherImpl:275 - closing statement
13:46:22,200 DEBUG JDBCExceptionReporter:49 - could not insert: [lanox.snmp.implementations.Net_printer#1]
java.sql.SQLException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '1' for key 1"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
net.sf.hibernate.exception.ConstraintViolationException: could not insert: [lanox.snmp.implementations.Net_printer#1]
at net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:73)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at net.sf.hibernate.persister.AbstractEntityPersister.convert(AbstractEntityPersister.java:1331)
at net.sf.hibernate.persister.NormalizedEntityPersister.insert(NormalizedEntityPersister.java:464)
at net.sf.hibernate.persister.NormalizedEntityPersister.insert(NormalizedEntityPersister.java:426)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1772)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1619)
at net.sf.hibernate.persister.NormalizedEntityPersister.insert(NormalizedEntityPersister.java:454)
at net.sf.hibernate.persister.NormalizedEntityPersister.insert(NormalizedEntityPersister.java:426)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:37)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2392)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:37)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2392)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at lanox.test.CreateDevice.main(CreateDevice.java:54)
Caused by: java.sql.SQLException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '1' for key 1"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at lanox.test.CreateDevice.main(CreateDevice.java:54)
13:46:22,200 WARN JDBCExceptionReporter:57 - SQL Error: 1062, SQLState: 23000
13:46:22,200 ERROR JDBCExceptionReporter:58 - Duplicate key or integrity constraint violation message from server: "Duplicate entry '1' for key 1"
13:46:22,216 ERROR SessionImpl:2400 - Could not synchronize database state with session
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1772)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1619)
at net.sf.hibernate.persister.NormalizedEntityPersister.insert(NormalizedEntityPersister.java:454)
... 8 more

Name and version of the database you are using:
mySQL 4.1.8-nt

The generated SQL (show_sql=true):
sane as above?

Debug level Hibernate log excerpt:
debug
[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 01, 2005 10:50 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
As I can see that's exactly what cannot be done - mixing joined and sub classes.

Try using Hibernate3, where this can be done.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 02, 2005 10:12 am 
Newbie

Joined: Tue Mar 01, 2005 8:30 am
Posts: 2
Ok, I have upgradet to hibernate 3 and done a first test with this new Device.hbm.xml.

I have a question about the documentation of hibernate 2 anyway:

It is even possible to use different mapping strategies for different branches of the same inheritance hierarchy, but the same limitations apply as apply to table-per-concrete class mappings. Hibernate does not support mixing <subclass> mappings and <joined-subclass> mappings inside the same <class> element.

Doesn't that mean the mapping in the original post is correct? As far as I understand the documentation I just can not use different mapping strategies in the same branch of the inheritance hierarchy. Meaning that I can not have one Sub of Base mapped in a joined-subclass and the other one in subclass.

About the current mapping It looks unnaturally to me that I have to join the table to the Net_printer class as it belongs more to the IPrinter interface. But if I try to join the IPrinter I get a complained and I can not use both in the same subclass.

If I run the current mapping However I do get a dead-lock inserting a new record.

Device.hbm.xml

<hibernate-mapping package="lanox.core">
<class name="Device"
table="devices" >
<id name="id" column="id" type="long" unsaved-value="0">
<generator class="increment"/>
</id>

<discriminator column="system_oid" type="string"/>

<property name="asset" column="asset" type="long"/>
<property name="serial" column="serial" type="string"/>
<property name="allocation" column="allocation" type="string"/>
<property name="row_insert" column="row_insert" type="timestamp"/>
<property name="row_update" column="row_update" type="timestamp"/>
<property name="invalidate_cnt" column="invalidate_cnt" type="long"/>

<component name="base" class="BaseDevice">
<property name="name" column="name" type="string"/>
<property name="dns_name" column="dns_name" type="string"/>
<property name="mac" column="mac" type="string" />
<one-to-one name="snmpParameters" class="SnmpParameters" cascade="all" />
</component>

<one-to-one name="address" class="DeviceIPAddress" cascade="all"/>

<subclass name="lanox.core.IPrinter">
<subclass name="lanox.snmp.implementations.Net_printer" discriminator-value=".1.3.6.1.4.1.11.2.3.9.1">
<join table="printer">
<key column="id"/>
<property name="description" column="description" type="string" />
</join>
</subclass>
</subclass>

<subclass name="IMultiportDevice">
<map name="ports" order-by="port_id, group_id" cascade="all-delete-orphan" table="ports" >
<key column="device_id"/>
<composite-index class="lanox.core.PortKey">
<key-property name="port_id" column="port_id" />
<key-property name="group_id" column="group_id" />
</composite-index>

<one-to-many class="Port"/>
</map>
<join table="multiport_devices">
<key column="id"/>
</join>
</subclass>


</class>
</hibernate-mapping>


Stack trace
14:39:18,208 DEBUG JDBCTransaction:46 - begin
14:39:18,208 DEBUG JDBCTransaction:50 - current autocommit status: false
14:39:18,208 DEBUG DefaultSaveOrUpdateEventListener:159 - saving transient instance
14:39:18,208 DEBUG IncrementGenerator:65 - fetching initial value: select max(id) from devices
14:39:18,223 DEBUG IncrementGenerator:81 - first free id: 1
14:39:18,223 DEBUG AbstractSaveEventListener:89 - generated identifier: 1, using strategy: org.hibernate.id.IncrementGenerator
14:39:18,223 DEBUG AbstractSaveEventListener:132 - saving [lanox.snmp.implementations.Net_printer#1]
14:39:18,223 DEBUG Cascades:806 - processing cascade ACTION_SAVE_UPDATE for: lanox.snmp.implementations.Net_printer
14:39:18,239 DEBUG Cascades:831 - done processing cascade ACTION_SAVE_UPDATE for: lanox.snmp.implementations.Net_printer
14:39:18,255 DEBUG Cascades:806 - processing cascade ACTION_SAVE_UPDATE for: lanox.snmp.implementations.Net_printer
14:39:18,255 DEBUG Cascades:152 - cascading to saveOrUpdate: lanox.core.SnmpParameters
14:39:18,270 DEBUG Cascades:525 - id unsaved-value: 0
14:39:18,270 DEBUG AbstractSaveEventListener:408 - transient instance of: lanox.core.SnmpParameters
14:39:18,270 DEBUG DefaultSaveOrUpdateEventListener:159 - saving transient instance
14:39:18,270 DEBUG AbstractSaveEventListener:89 - generated identifier: 1, using strategy: org.hibernate.id.ForeignGenerator
14:39:18,270 DEBUG AbstractSaveEventListener:132 - saving [lanox.core.SnmpParameters#1]
14:39:18,270 DEBUG Cascades:152 - cascading to saveOrUpdate: lanox.core.DeviceIPAddress
14:39:18,270 DEBUG Cascades:525 - id unsaved-value: 0
14:39:18,270 DEBUG AbstractSaveEventListener:408 - transient instance of: lanox.core.DeviceIPAddress
14:39:18,270 DEBUG DefaultSaveOrUpdateEventListener:159 - saving transient instance
14:39:18,270 DEBUG AbstractSaveEventListener:89 - generated identifier: 1, using strategy: org.hibernate.id.ForeignGenerator
14:39:18,286 DEBUG AbstractSaveEventListener:132 - saving [lanox.core.DeviceIPAddress#1]
14:39:18,286 DEBUG Cascades:831 - done processing cascade ACTION_SAVE_UPDATE for: lanox.snmp.implementations.Net_printer
14:39:18,286 DEBUG JDBCTransaction:83 - commit
14:39:18,286 DEBUG SessionImpl:292 - automatically flushing session
14:39:18,286 DEBUG AbstractFlushingEventListener:52 - flushing session
14:39:18,286 DEBUG AbstractFlushingEventListener:102 - processing flush-time cascades
14:39:18,286 DEBUG Cascades:806 - processing cascade ACTION_SAVE_UPDATE for: lanox.snmp.implementations.Net_printer
14:39:18,286 DEBUG Cascades:152 - cascading to saveOrUpdate: lanox.core.SnmpParameters
14:39:18,286 DEBUG AbstractSaveEventListener:392 - persistent instance of: lanox.core.SnmpParameters
14:39:18,286 DEBUG DefaultSaveOrUpdateEventListener:103 - ignoring persistent instance
14:39:18,301 DEBUG DefaultSaveOrUpdateEventListener:140 - object already associated with session: [lanox.core.SnmpParameters#1]
14:39:18,301 DEBUG Cascades:152 - cascading to saveOrUpdate: lanox.core.DeviceIPAddress
14:39:18,301 DEBUG AbstractSaveEventListener:392 - persistent instance of: lanox.core.DeviceIPAddress
14:39:18,301 DEBUG DefaultSaveOrUpdateEventListener:103 - ignoring persistent instance
14:39:18,301 DEBUG DefaultSaveOrUpdateEventListener:140 - object already associated with session: [lanox.core.DeviceIPAddress#1]
14:39:18,301 DEBUG Cascades:831 - done processing cascade ACTION_SAVE_UPDATE for: lanox.snmp.implementations.Net_printer
14:39:18,301 DEBUG AbstractFlushingEventListener:150 - dirty checking collections
14:39:18,301 DEBUG AbstractFlushingEventListener:167 - Flushing entities and processing referenced collections
14:39:18,301 DEBUG BasicEntityPersister:2575 - lanox.snmp.implementations.Net_printer.row_insert is dirty
14:39:18,317 DEBUG DefaultFlushEntityEventListener:121 - Updating entity: [lanox.snmp.implementations.Net_printer#1]
14:39:18,317 DEBUG AbstractFlushingEventListener:203 - Processing unreferenced collections
14:39:18,317 DEBUG AbstractFlushingEventListener:217 - Scheduling collection removes/(re)creates/updates
14:39:18,317 DEBUG AbstractFlushingEventListener:79 - Flushed: 3 insertions, 1 updates, 0 deletions to 3 objects
14:39:18,317 DEBUG AbstractFlushingEventListener:85 - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
14:39:18,317 DEBUG Printer:83 - listing entities:
14:39:18,348 DEBUG Printer:90 - lanox.core.SnmpParameters{device=lanox.core.Device#1, write_community=public, read_community=public, system_oid=.1.3.6.1.4.1.11.2.3.9.1, id=1}
14:39:18,380 DEBUG Printer:90 - lanox.snmp.implementations.Net_printer{base=component[name,dns_name,mac,snmpParameters]{dns_name=ost0007.ost.eur.webdti.com, snmpParameters=lanox.core.SnmpParameters#1, name=null, mac=00-60-b0-ad-7e-ce}, allocation=STATIC, invalidate_cnt=0, row_insert=2005-03-02 14:39:18, asset=0, row_update=2005-03-02 14:39:18, description=null, address=lanox.core.DeviceIPAddress#1, id=1, serial=null}
14:39:18,395 DEBUG Printer:90 - lanox.core.DeviceIPAddress{device=lanox.core.Device#1, ip_c=33, ip_a=153, ip_b=115, ip_d=7, id=1}
14:39:18,395 DEBUG AbstractFlushingEventListener:267 - executing flush
14:39:18,395 DEBUG BasicEntityPersister:1795 - Inserting entity: [lanox.snmp.implementations.Net_printer#1]
14:39:18,395 DEBUG AbstractBatcher:258 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
14:39:18,395 DEBUG SQL:292 - /*insert lanox.snmp.implementations.Net_printer*/insert into devices (asset, serial, allocation, row_insert, row_update, invalidate_cnt, name, dns_name, mac, system_oid, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, '.1.3.6.1.4.1.11.2.3.9.1', ?)
Hibernate: /*insert lanox.snmp.implementations.Net_printer*/insert into devices (asset, serial, allocation, row_insert, row_update, invalidate_cnt, name, dns_name, mac, system_oid, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, '.1.3.6.1.4.1.11.2.3.9.1', ?)
14:39:18,395 DEBUG AbstractBatcher:343 - preparing statement
14:39:18,395 DEBUG BasicEntityPersister:1587 - Dehydrating entity: [lanox.snmp.implementations.Net_printer#1]
14:39:18,411 DEBUG LongType:59 - binding '0' to parameter: 1
14:39:18,411 DEBUG StringType:52 - binding null to parameter: 2
14:39:18,411 DEBUG StringType:59 - binding 'STATIC' to parameter: 3
14:39:18,411 DEBUG TimestampType:59 - binding '2005-03-02 14:39:18' to parameter: 4
14:39:18,426 DEBUG TimestampType:52 - binding null to parameter: 5
14:39:18,426 DEBUG LongType:59 - binding '0' to parameter: 6
14:39:18,426 DEBUG StringType:52 - binding null to parameter: 7
14:39:18,442 DEBUG StringType:59 - binding 'ost0007.ost.eur.webdti.com' to parameter: 8
14:39:18,442 DEBUG StringType:59 - binding '00-60-b0-ad-7e-ce' to parameter: 9
14:39:18,442 DEBUG LongType:59 - binding '1' to parameter: 10
14:39:18,442 DEBUG AbstractBatcher:27 - Adding to batch
14:39:18,442 DEBUG BasicEntityPersister:1795 - Inserting entity: [lanox.snmp.implementations.Net_printer#1]
14:39:18,442 DEBUG AbstractBatcher:54 - Executing batch size: 1
14:40:09,723 DEBUG AbstractBatcher:266 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
14:40:09,723 DEBUG AbstractBatcher:363 - closing statement
14:40:09,723 DEBUG JDBCExceptionReporter:49 - Could not execute JDBC batch update [/*insert lanox.snmp.implementations.Net_printer*/insert into devices (asset, serial, allocation, row_insert, row_update, invalidate_cnt, name, dns_name, mac, system_oid, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, '.1.3.6.1.4.1.11.2.3.9.1', ?)]
java.sql.BatchUpdateException: Deadlock found when trying to get lock; Try restarting transaction message from server: "Lock wait timeout exceeded; try restarting transaction"
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1492)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:154)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:71)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:66)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1812)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2171)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:669)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at lanox.collectors.DiscoveryThread.processNewDevice(DiscoveryThread.java:211)
at lanox.collectors.DiscoveryThread.run(DiscoveryThread.java:81)
at lanox.test.DiscoveryTest.test_singlethreaded(DiscoveryTest.java:62)
at lanox.test.DiscoveryTest.main(DiscoveryTest.java:67)
14:40:09,739 WARN JDBCExceptionReporter:57 - SQL Error: 1205, SQLState: 41000
14:40:09,739 ERROR JDBCExceptionReporter:58 - Deadlock found when trying to get lock; Try restarting transaction message from server: "Lock wait timeout exceeded; try restarting transaction"
14:40:09,739 ERROR AbstractFlushingEventListener:277 - Could not synchronize database state with session
org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:77)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:161)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:71)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:66)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1812)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2171)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:669)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at lanox.collectors.DiscoveryThread.processNewDevice(DiscoveryThread.java:211)
at lanox.collectors.DiscoveryThread.run(DiscoveryThread.java:81)
at lanox.test.DiscoveryTest.test_singlethreaded(DiscoveryTest.java:62)
at lanox.test.DiscoveryTest.main(DiscoveryTest.java:67)
Caused by: java.sql.BatchUpdateException: Deadlock found when trying to get lock; Try restarting transaction message from server: "Lock wait timeout exceeded; try restarting transaction"
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1492)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:154)
... 17 more
14:40:09,786 ERROR collectors:97 - Hibernate exception:
14:40:09,786 ERROR collectors:97 - Hibernate exception:
14:40:09,786 ERROR collectors:98 - Could not execute JDBC batch update
14:40:09,786 ERROR collectors:98 - Could not execute JDBC batch update


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.