-->
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.  [ 2 posts ] 
Author Message
 Post subject: strange org.hibernate.exception.ConstraintViolationException
PostPosted: Wed Jun 06, 2012 4:38 am 
Newbie

Joined: Tue Apr 17, 2012 5:58 am
Posts: 5
Hi all,

I have 2 applications working on the same oracle db schema: j2se (desktop application) and web application(deployed on tomcat 7).
and this my entity class :
Code:
public class Owner implements Serializable {
   private static final long serialVersionUID = 1L;

   @Id
   @SequenceGenerator(name="OWNERS_OWNERID_GENERATOR", sequenceName="OWNERS_SEQ",allocationSize=1)
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="OWNERS_OWNERID_GENERATOR")
   @Column(name="OWNER_ID", unique=true, nullable=false)
   private long ownerId;

   @Column(nullable=false, length=40)
   private String description;


    public Owner() {
    }

    setters and getteres
}



everything is ok in the desktop application, but when I package my entity with persistence.xml in a jar file and then add it to the class path of the web application and to the lib folder in WEB-INF, then try to persist the entity to the db i have the following exception
Code:
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: ORA-00001: unique constraint (owner.pk) violated


Note: when copy the entity class package and persistence.xml from the desktop application to the web application, everything is ok:)

thnks in advance


Top
 Profile  
 
 Post subject: Re: strange org.hibernate.exception.ConstraintViolationException
PostPosted: Wed Jun 06, 2012 1:14 pm 
Beginner
Beginner

Joined: Mon Jun 04, 2012 12:31 pm
Posts: 20
Where's the code that persists it?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.