-->
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.  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Unique Key violation on insert
PostPosted: Mon Apr 24, 2006 8:37 am 
Newbie

Joined: Mon Apr 24, 2006 5:57 am
Posts: 1
Hi,
I have an issue in my multi-tiered application where I have detached my objects from the Session.
I have a user edit via the GUI the properties of a parent object along with adding, editing, and removal of child objects (collection within the parent).
I am cascading all including orphaned deletes between the parent object and its children.
Upon associating the objects with a Session (saveOrUpdate etc.) the inserts and deletes are occurring but the order in which it occurs violates a unique

constraint
of the business (natural) key of the child object if the user of the GUI deletes and then adds back in the same business key).

After consulting the book "Hibernate in Action" and also the online reference pages
I still could not seem to find a definitive answer to the problem of unique constraints being violated
when an item has been removed and then added back into a collection of children of a parent object.

Gavin has stated, in the posting below..
http://forum.hibernate.org/viewtopic.ph ... e25f5c73c1

that Hibernate never issues the deletes before the inserts.

The documentation states the following ordering on a call to flush()

1. all entity insertions in the same order as the Save was called on them
2. all entity updates
3. all collection deletions
4. all collection element deletions, updates and insertions
5. all collection insertions
6. all entity deletions in the same order as the delete was called.

4. Implies the order as being "deletions, updates and insertions" or is the documentation not
strictly specifying an order here?

Hibernate appears not to match this order as inserts are occurring before deletes for my collection elements.
If Hibernate always issues the inserts first then what is the recommended solution to this problem?
Do we have to step out of the Hibernate world and handle this relationship ourselves?

If so, then fine, but I really do not want to have to code around this if there is a
solution available in Hibernate.

If I have a table with a surrogate primary key for the <id> AND a unique constraint
on another column(s) can I get Hibernate to honour the unique constraint when it calls flush()
by tweaking attributes in the mapping file?

From the online reference documentation:
"Hibernate however doesn't have enough information to correctly arrange SQL INSERT and UPDATE statements (to avoid constraint violations), and needs some

help to handle bi-directional associations properly. Making one side of the association inverse tells Hibernate to basically ignore it, to consider it a

mirror of the other side. That's all that is necessary for Hibernate to work out all of the issues when transformation a directional navigation model to a

SQL database schema."

I have the inverse="true" attribute included.

I have also tried setting the following attributes on the <many-to-one> relationship in the mapping file

Code:
index="index_name"
   unique_key="unique_key_id"
   foreign-key="foreign_key_name"

although the docs do not go into any detail regarding their usage.

Does my class need another <column> entry for the unique constraint I am adding?


I will continue to search for a solution to this problem for a time while I wait for a reply to this posting. Like I said, I do not want to code around this

as Hibernate has been very good and has taken care of all of our persistence requirements up till now.

I can post some code if it will make things clearer.


cheers,


Hibernate version: 3

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

<hibernate-mapping package="com.tadgh2006.hibern8play" default-lazy="false" >

<class name="ParentDTO" table="tbl_Parent" >

<id name="id" column="Id" type="integer">
<generator class="native"/>
</id>

<natural-id mutable="true">
<property name="businessKey" column="BusinessKey" type="string" not-null="true" />
</natural-id>

<set name="children" inverse="true" cascade="all-delete-orphan" >
<key column="ParentId" />
<one-to-many class="ChildDTO"/>
</set>

</class>
<query name="com.tadgh2006.hibern8play.ParentDTOByBusinessKey">from ParentDTO p where p.businessKey = :businessKey</query>
</hibernate-mapping>

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


<hibernate-mapping package="com.tadgh2006.hibern8play" default-lazy="false">

<class name="ChildDTO" table="tbl_Child" >

<id name="id" column="Id" type="integer">
<generator class="native" />
</id>

<natural-id mutable="true">
<property name="businessKey" column="BusinessKey" type="string" not-null="true" />
</natural-id>
<many-to-one name="parent" column="ParentId" class="ParentDTO" not-null="true" fetch="join" />
</class>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
public void save(Object object)
{
try
{
Session session = HibernateUtil.getCurrentSession();
HibernateUtil.beginTransaction();
session.update(object);
session.save(object);
HibernateUtil.commitTransaction();
}
catch ( HibernateException e )
{
handleException(e);
}
finally
{
HibernateUtil.closeSession();
}

}
Full stack trace of any exception that occurs:
Cannot insert duplicate key row in object 'tbl_Child' with unique index 'IX_tbl_Child_BusinessKey'.
Name and version of the database you are using:
Microsoft SQL Server 2000 sp4
The generated SQL (show_sql=true):
Hibernate: insert into tbl_Child (BusinessKey, ParentId) values (?, ?)


Top
 Profile  
 
 Post subject: Insert before Delete
PostPosted: Wed May 03, 2006 6:41 am 
Newbie

Joined: Wed May 03, 2006 6:25 am
Posts: 4
Hi,

I have exactly the same issue.
I have a multi-tiered application and using surrogate keys as recommended and also have a unique indices on my business keys.
Retrieval of a parent child DTO's with all,delete-orphaned and disconnecting the DTO's from the session and allowing the user to edit the children (add, update, delete).
Upon attaching back to the session for persistence (merge / saveOrUpdate) the inserts for the child DTO is being actioned before the deletes thus violating my unique business key for the child table.

I see that over 57 people have read your post with no hint of an answer.

The documentation is not too clear on the order of deletes or does not match what I am observing and feel that hibernate is missing some very usefull functionality (or has a flaw).

If you do obtain a decent solution I would very much appreciate this information also.

We are currently using a work around in our DAO of obtaining the previously assigned Id from the database and re-using it for the passed in children DTO objects. It would be nicer not to have to keep writing all this code in our DAO and just let Hibernate work this out.

Good luck in your search.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 5:40 am 
Newbie

Joined: Fri Feb 10, 2006 11:19 am
Posts: 5
I have exactly the same problem. I wounder is it possible to use an interceptor which uses the natural-id and then runs the select based on this natural-id to retrieve the surrogare key.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 6:12 am 
Newbie

Joined: Fri Feb 10, 2006 11:19 am
Posts: 5
Same problem described here

http://forum.hibernate.org/viewtopic.php?t=959869


Top
 Profile  
 
 Post subject: any resolution to this one yet?
PostPosted: Fri Jun 09, 2006 12:08 pm 
Regular
Regular

Joined: Fri Jan 28, 2005 3:11 am
Posts: 81
any resolution to this one yet - I have the same problem


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 09, 2006 5:14 pm 
Regular
Regular

Joined: Mon May 22, 2006 2:30 pm
Posts: 74
Has anyone run the scenario with HIbernate logging enabled at the DEBUG level? That would show you all the SQL statements issued, and you could match them to the documented behaviour to determine if there appears to be some discrepancy. If someone could post the debug, that would be good too.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 09, 2006 6:05 pm 
Regular
Regular

Joined: Fri Jan 28, 2005 3:11 am
Posts: 81
yeah, I've done it with the debug: you can see my whole scenario at:
http://www.experts-exchange.com/Program ... 81019.html


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 21, 2007 3:21 am 
Regular
Regular

Joined: Sat May 20, 2006 3:49 am
Posts: 78
hello!

I have the same problem and can't find any solution for it. I don't know if it is a configuration problem or a hibernate error.

my error log:

Code:
2007-06-21 09:11:49,312 ERROR [org.hibernate.util.JDBCExceptionReporter] - ORA-00001: Unique Constraint (DSEAS.PATIENT_SOCIAL_INSURANCE_UK) verletzt

2007-06-21 09:11:49,312 ERROR [org.hibernate.util.JDBCExceptionReporter] - ORA-00001: Unique Constraint (DSEAS.PATIENT_SOCIAL_INSURANCE_UK) verletzt

2007-06-21 09:11:49,328 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
   at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
   at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
   at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
   at org.dseas.base.hibernate.Connection.commit(Connection.java:85)
   at org.dseas.business.service.PatientService.save(PatientService.java:105)
   at org.dseas.ui.rcp.editor.patient.PatientEditorPart.doSave(PatientEditorPart.java:1056)
   at org.eclipse.ui.internal.SaveableHelper$1.run(SaveableHelper.java:131)
   at org.eclipse.ui.internal.SaveableHelper$4.run(SaveableHelper.java:252)
   at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369)
   at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313)
   at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:763)
   at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
   at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:760)
   at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2283)
   at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:258)
   at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:136)
   at org.eclipse.ui.internal.EditorManager.savePart(EditorManager.java:1386)
   at org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage.java:2995)
   at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3008)
   at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:67)
   at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
   at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
   at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
   at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:441)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
   at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
   at org.dseas.ui.rcp.Application.run(Application.java:23)
   at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
   at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
   at org.eclipse.core.launcher.Main.run(Main.java:977)
   at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: java.sql.BatchUpdateException: ORA-00001: Unique Constraint (DSEAS.PATIENT_SOCIAL_INSURANCE_UK) verletzt

   at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
   at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10657)
   at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
   ... 51 more
2007-06-21 09:11:49,359 ERROR [org.dseas.ui.rcp.logging.LogView] - Error while commiting the transaction


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 22, 2007 4:17 am 
Regular
Regular

Joined: Sat May 20, 2006 3:49 am
Posts: 78
perhaps someone from above could reply if they found a solution? I can't find any docu on INSERT/DELETE ordering.


Top
 Profile  
 
 Post subject: Not a solution, a workaround and more ideas
PostPosted: Fri Jun 22, 2007 5:11 am 
Newbie

Joined: Sat Sep 24, 2005 10:44 am
Posts: 12
Location: Berlin, Germany
I have hard coded all lookups for any class by using the unique key in a hibernateTemplate.find(...). It's not a good solution, because it could only hard maintained.

I have done other testcases, where i Use SaveListeners, IDGenerators, Interceptors. But i have no plugable solution found yet, but i unterstood a lot of the internal things in hibernate.

Code snipped out of my test:

Code:
   <property name="eventListeners">
         <map>
            <entry key="save-update">
               <bean class="CustomSaveOrUpdateEventListener" />
            </entry>
         </map>
      </property>


Code:
<property name="entityInterceptor" >
         <bean class="UniqueKeyInterceptor" >
         </bean>
      </property>


All tries to change the ID at a none persist object stall !

I need more research in Interceptors ....

Martin


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 23, 2007 5:54 am 
Regular
Regular

Joined: Sat May 20, 2006 3:49 am
Posts: 78
what does that have to do with my unique constraint violation? I have no problem with the update but with the insert/delete ordering of hibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 23, 2007 12:38 pm 
Regular
Regular

Joined: Sat May 20, 2006 3:49 am
Posts: 78
hmm... I have found an older thread with the same question: http://forum.hibernate.org/viewtopic.php?t=934483

Here someone posted "The problem with UK violations is because the users have defined a different PK to the one Hibernate expects: (fk, indexCol)." So it seems Hibernate Tools has generated some wrong PK, because I never touched my POJOs and there annotations |o|

here are my pojos:

Code:
@MappedSuperclass
public class Base {

    protected String id;

    ...

    @GenericGenerator(name = "generator", strategy = "guid", parameters = {})
    @Id
    @Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true, length = 38)
    @GeneratedValue(generator = "generator")
    public String getId() {
   return this.id;
    }

    public void setId(String id) {
   this.id = id;
    }

    ...

    @Override
    public boolean equals(Object obj) {
   if (obj instanceof Base) {
       Base base = (Base) obj;
       if (base.getId() != null && id != null) {
      return base.getId().equals(id);
       } else {
      return super.equals(obj);
       }
   } else {
       return false;
   }
    }
}


Code:
/**
* PatientEntity generated by hbm2java
*/
@MappedSuperclass
public abstract class PatientEntity extends Base implements
   java.io.Serializable {

    ...
    private Set<PatientSocialInsurance> patientSocialInsurances = new HashSet<PatientSocialInsurance>(
       0);

    ...

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "patient")
    @Cascade( { org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
    public Set<PatientSocialInsurance> getPatientSocialInsurances() {
   return this.patientSocialInsurances;
    }


Code:
/**
* PatientSocialInsuranceEntity generated by hbm2java
*/
@MappedSuperclass
public abstract class PatientSocialInsuranceEntity extends Base implements
   java.io.Serializable {

    protected SocialInsurance socialInsurance;

    protected Patient patient;

    protected String codeTypeDefault;

    protected String codeMembershipNo;

    public PatientSocialInsuranceEntity() {
    }

    public PatientSocialInsuranceEntity(String id,
       SocialInsurance socialInsurance, AppUser userCre, Patient patient,
       String codeTypeDefault, Date timeCre) {
   this.id = id;
   this.socialInsurance = socialInsurance;
   this.userCre = userCre;
   this.patient = patient;
   this.codeTypeDefault = codeTypeDefault;
   this.timeCre = timeCre;
    }

    public PatientSocialInsuranceEntity(String id, AppUser userUpd,
       SocialInsurance socialInsurance, AppUser userCre, Patient patient,
       String codeTypeDefault, String codeMembershipNo, Date timeCre,
       Date timeUpd) {
   this.id = id;
   this.userUpd = userUpd;
   this.socialInsurance = socialInsurance;
   this.userCre = userCre;
   this.patient = patient;
   this.codeTypeDefault = codeTypeDefault;
   this.codeMembershipNo = codeMembershipNo;
   this.timeCre = timeCre;
   this.timeUpd = timeUpd;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SOC_INS_ID", nullable = false)
    public SocialInsurance getSocialInsurance() {
   return this.socialInsurance;
    }

    public void setSocialInsurance(SocialInsurance socialInsurance) {
   this.socialInsurance = socialInsurance;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PATIENT_ID", nullable = false)
    public Patient getPatient() {
   return this.patient;
    }

    public void setPatient(Patient patient) {
   this.patient = patient;
    }

    @Column(name = "CODE_TYPE_DEFAULT", nullable = false, length = 1)
    public String getCodeTypeDefault() {
   return this.codeTypeDefault;
    }

    public void setCodeTypeDefault(String codeTypeDefault) {
   this.codeTypeDefault = codeTypeDefault;
    }

    @Column(name = "CODE_MEMBERSHIP_NO", length = 1000)
    public String getCodeMembershipNo() {
   return this.codeMembershipNo;
    }

    public void setCodeMembershipNo(String codeMembershipNo) {
   this.codeMembershipNo = codeMembershipNo;
    }

    // The following is extra code specified in the hbm.xml files
    private static final long serialVersionUID = 1L;
    // end of extra code specified in the hbm.xml files

}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 09, 2007 12:07 pm 
Regular
Regular

Joined: Sat May 20, 2006 3:49 am
Posts: 78
as we still have the problem...

@hibernate-gurus: what could be the problem of the wrong DELETE-INSERT order?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 27, 2007 12:57 pm 
Regular
Regular

Joined: Sat May 20, 2006 3:49 am
Posts: 78
I have found a JIRA issue regarding the same problem: http://opensource.atlassian.com/project ... e/HHH-1721

perhaps the author of the issue could help me...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 11:00 am 
Regular
Regular

Joined: Sat May 20, 2006 3:49 am
Posts: 78
I have now updated the @UniqueConstraints annotation, but seems that is not the problem because we have still the problem.

Code:
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.dseas.base.entities.PatientSocialInsuranceEntity;

@Entity
@Table(name = "PATIENT_SOCIAL_INSURANCE", uniqueConstraints = @UniqueConstraint(columnNames = {
   "PATIENT_ID", "SOC_INS_ID" }))
public class PatientSocialInsurance extends PatientSocialInsuranceEntity {

   private static final long serialVersionUID = 1L;
}


i still get the unique constraint violation:
Code:
DEBUG - persisting patient...
DEBUG - transaction org.hibernate.ejb.TransactionImpl@44ac6a started
DEBUG - update timestamp and userstamp for base record set
DEBUG - update timestamp and userstamp for base record set
DEBUG - update timestamp and userstamp for base record set
DEBUG - update timestamp and userstamp for base record set
DEBUG - update timestamp and userstamp for base record set
DEBUG - select rawtohex(sys_guid()) from dual
DEBUG - insert timestamp and userstamp for base record set
DEBUG - insert into dseas.PATIENT_SOCIAL_INSURANCE (TIME_CRE, TIME_UPD, USER_CRE, USER_UPD, CODE_MEMBERSHIP_NO, CODE_TYPE_DEFAULT, PATIENT_ID, SOC_INS_ID, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
ERROR - ORA-00001: Unique Constraint (DSEAS.PATIENT_SOCIAL_INSURANCE_UK) verletzt

ERROR - ORA-00001: Unique Constraint (DSEAS.PATIENT_SOCIAL_INSURANCE_UK) verletzt

ERROR - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
   at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
   at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
   at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
   at org.dseas.base.hibernate.EntityManagerFacade.commit(EntityManagerFacade.java:78)
   at org.dseas.business.service.maindata.PatientEditorService.save(PatientEditorService.java:112)
   at org.dseas.ui.rcp.editor.patient.PatientEditorPart.doSave(PatientEditorPart.java:1298)
   at org.eclipse.ui.internal.SaveableHelper$1.run(SaveableHelper.java:143)
   at org.eclipse.ui.internal.SaveableHelper$4.run(SaveableHelper.java:266)
   at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369)
   at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313)
   at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:758)
   at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
   at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:755)
   at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2451)
   at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:274)
   at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:253)
   at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:148)
   at org.eclipse.ui.internal.EditorManager.savePart(EditorManager.java:1345)
   at org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage.java:3184)
   at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3197)
   at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:73)
   at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
   at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545)
   at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
   at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:443)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
   at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
   at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
   at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
   at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
   at org.dseas.ui.rcp.Application.start(Application.java:22)
   at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:504)
   at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
   at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
   at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
Caused by: java.sql.BatchUpdateException: ORA-00001: Unique Constraint (DSEAS.PATIENT_SOCIAL_INSURANCE_UK) verletzt

   at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
   at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10657)
   at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
   ... 55 more
ERROR - Error while commiting the transaction


any ideas? nobody ever had this problem?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 16 posts ]  Go to page 1, 2  Next

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.