-->
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.  [ 1 post ] 
Author Message
 Post subject: get unique id from MultipleHiLoPerTableGenerator
PostPosted: Wed May 24, 2006 7:46 pm 
Newbie

Joined: Tue Sep 06, 2005 12:10 pm
Posts: 5
Hibernate version:3.0.5

Mapping documents:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class xxx.xxx.xxx.ProfileAuditLogDetailsModel" table="PROFILE_AUDIT_LOG_DETAILS">

<!-- try native generator -->
<id name="rowId" column="ROW_ID">
<generator class="org.hibernate.id.MultipleHiLoPerTableGenerator">
<param name="table">hilosequences</param>
<param name="primary_key_column">sequencename</param>
<param name="value_column">highvalues</param>
</generator>
<!--<generator class="native"/>-->
</id>
<property name="profileId" column="PROFILE_ID"/>
<property name="logId" column="LOG_ID"/>
<property name="MPN" column="MPN"/>
<property name="awardQtyBeforeChange" column="AWARD_QTY_BEFORE_CHANGE"/>
<property name="awardQtyAfterChange" column="AWARD_QTY_AFTER_CHANGE" />
<property name="priceBeforeChange" column="PRICE_BEFORE_CHANGE"/>
<property name="priceAfterChange" column="PRICE_AFTER_CHANGE"/>
<property name="action" column="ACTION"/>

Full stack trace of any exception that occurs:
2006-05-23 02:17:58,531 DEBUG [xxx.xxx.xxx.DataServiceImpl] object saved, xxx.xxx.xxx.ProfileAuditLogDetailsModel

2006-05-23 02:17:58,609 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 1, SQLState: 23000

2006-05-23 02:17:58,609 ERROR [org.hibernate.util.JDBCExceptionReporter] ORA-00001: unique constraint (EQ_OWNER.PK_PROFILE_AUDIT_LOG_DETAILS) violated


Name and version of the database you are using:
Oracle 9i

Hello, we are using MultipleHiLoPerTableGenerator to generate row_id which is the PK for our profile_audit_log_details table. There might be some dirty data which causes a primary key unique constraint violation. We try to figure out which rows of the existing data in the table are causing the problem.

We know the rowId property will be populated if the ProfileAuditLogDetailsModel is saved to database successfully. But how about this scenario, saving object to the database failed because of the unique constraint violation.

Is there a way I can get the current ID which is generated by the MultipleHiLoPerTableGenerator which causes this problem?

Thanks a lot and have a great day,

Jiao


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

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.