-->
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: Sequence Generator
PostPosted: Thu Mar 21, 2013 9:28 pm 
Newbie

Joined: Tue Aug 18, 2009 5:14 pm
Posts: 1
I have an application deployed on Jboss 7.1.0 FINAL in which I have an entity that when persisting it appears to be caught in an infinite loop when selecting the sequence for the id.

@Entity
@Table(name = "FAKE_TABLE", schema = "FAKE_SCHEMA")
public class Fake implements Serializable {
....
@Id
@SequenceGenerator(name = "FAKE_SEQ", sequenceName = "FAKE_SCHEMA.SEQUENCE_SEQ", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "FAKE_SEQ")
@Column(name = "FAKEKEY", unique = true, nullable = false, precision = 22, scale = 0)
public Integer getFakeKey() {
return this.fakeKey;
}


then in some code
....
Fake fake = new Fake();
entityManager.persist(fake );
.....

Then the looping:

14:21:19,512 INFO [stdout] (http--127.0.0.1-8080-5) Hibernate:
14:21:19,512 INFO [stdout] (http--127.0.0.1-8080-5) select
14:21:19,512 INFO [stdout] (http--127.0.0.1-8080-5) FAKE_SCHEMA.SEQUENCE_SEQ.nextval
14:21:19,513 INFO [stdout] (http--127.0.0.1-8080-5) from
14:21:19,513 INFO [stdout] (http--127.0.0.1-8080-5) dual
14:21:19,607 INFO [stdout] (http--127.0.0.1-8080-5) Hibernate:
14:21:19,607 INFO [stdout] (http--127.0.0.1-8080-5) select
14:21:19,607 INFO [stdout] (http--127.0.0.1-8080-5) FAKE_SCHEMA.SEQUENCE_SEQ.nextval
14:21:19,608 INFO [stdout] (http--127.0.0.1-8080-5) from
14:21:19,609 INFO [stdout] (http--127.0.0.1-8080-5) dual
14:21:19,705 INFO [stdout] (http--127.0.0.1-8080-5) Hibernate:
14:21:19,706 INFO [stdout] (http--127.0.0.1-8080-5) select
14:21:19,706 INFO [stdout] (http--127.0.0.1-8080-5) FAKE_SCHEMA.SEQUENCE_SEQ.nextval
14:21:19,707 INFO [stdout] (http--127.0.0.1-8080-5) from
14:21:19,709 INFO [stdout] (http--127.0.0.1-8080-5) dual
14:21:19,814 INFO [stdout] (http--127.0.0.1-8080-5) Hibernate:
14:21:19,815 INFO [stdout] (http--127.0.0.1-8080-5) select
14:21:19,816 INFO [stdout] (http--127.0.0.1-8080-5) FAKE_SCHEMA.SEQUENCE_SEQ.nextval
14:21:19,816 INFO [stdout] (http--127.0.0.1-8080-5) from
14:21:19,817 INFO [stdout] (http--127.0.0.1-8080-5) dual
14:21:19,912 INFO [stdout] (http--127.0.0.1-8080-5) Hibernate:
14:21:19,912 INFO [stdout] (http--127.0.0.1-8080-5) select
14:21:19,912 INFO [stdout] (http--127.0.0.1-8080-5) FAKE_SCHEMA.SEQUENCE_SEQ.nextval
14:21:19,913 INFO [stdout] (http--127.0.0.1-8080-5) from
14:21:19,913 INFO [stdout] (http--127.0.0.1-8080-5) dual
14:21:20,008 INFO [stdout] (http--127.0.0.1-8080-5) Hibernate:
14:21:20,008 INFO [stdout] (http--127.0.0.1-8080-5) select
14:21:20,009 INFO [stdout] (http--127.0.0.1-8080-5) FAKE_SCHEMA.SEQUENCE_SEQ.nextval
14:21:20,009 INFO [stdout] (http--127.0.0.1-8080-5) from
14:21:20,010 INFO [stdout] (http--127.0.0.1-8080-5) dual
14:21:20,104 INFO [stdout] (http--127.0.0.1-8080-5) Hibernate:
14:21:20,104 INFO [stdout] (http--127.0.0.1-8080-5) select
14:21:20,104 INFO [stdout] (http--127.0.0.1-8080-5) IDENTITY.SEQUENCE_SEQ.nextval
14:21:20,105 INFO [stdout] (http--127.0.0.1-8080-5) from
14:21:20,105 INFO [stdout] (http--127.0.0.1-8080-5) dual
14:21:20,200 INFO [stdout] (http--127.0.0.1-8080-5) Hibernate:
14:21:20,200 INFO [stdout] (http--127.0.0.1-8080-5) select
14:21:20,200 INFO [stdout] (http--127.0.0.1-8080-5) FAKE_SCHEMA.SEQUENCE_SEQ.nextval
14:21:20,201 INFO [stdout] (http--127.0.0.1-8080-5) from
14:21:20,201 INFO [stdout] (http--127.0.0.1-8080-5) dual
14:21:20,298 INFO [stdout] (http--127.0.0.1-8080-5) Hibernate:
14:21:20,298 INFO [stdout] (http--127.0.0.1-8080-5) select
14:21:20,298 INFO [stdout] (http--127.0.0.1-8080-5) FAKE_SCHEMA.SEQUENCE_SEQ.nextval
14:21:20,299 INFO [stdout] (http--127.0.0.1-8080-5) from
14:21:20,299 INFO [stdout] (http--127.0.0.1-8080-5) dual
14:21:20,394 INFO [stdout] (http--127.0.0.1-8080-5) Hibernate:
14:21:20,394 INFO [stdout] (http--127.0.0.1-8080-5) select
14:21:20,394 INFO [stdout] (http--127.0.0.1-8080-5) IDENTITY.SEQUENCE_SEQ.nextval
14:21:20,395 INFO [stdout] (http--127.0.0.1-8080-5) from
14:21:20,395 INFO [stdout] (http--127.0.0.1-8080-5) dual
14:21:20,491 INFO [stdout] (http--127.0.0.1-8080-5) Hibernate:
14:21:20,491 INFO [stdout] (http--127.0.0.1-8080-5) select
14:21:20,492 INFO [stdout] (http--127.0.0.1-8080-5) FAKE_SCHEMA.SEQUENCE_SEQ.nextval
14:21:20,492 INFO [stdout] (http--127.0.0.1-8080-5) from
14:21:20,493 INFO [stdout] (http--127.0.0.1-8080-5) dual
14:21:20,589 INFO [stdout] (http--127.0.0.1-8080-5) Hibernate:
14:21:20,590 INFO [stdout] (http--127.0.0.1-8080-5) select
14:21:20,590 INFO [stdout] (http--127.0.0.1-8080-5) FAKE_SCHEMA.SEQUENCE_SEQ.nextval
14:21:20,591 INFO [stdout] (http--127.0.0.1-8080-5) from
14:21:20,591 INFO [stdout] (http--127.0.0.1-8080-5) dual

The sequence is getting incremented but the entity is never persisted it just keeps going in the above loop.
There are other persist transaction in the application which are working. This is particular to this entity only.


Version info:

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.9.Final</version>
<exclusions>
<exclusion>
<artifactId>cglib</artifactId>
<groupId>cglib</groupId>
</exclusion>
<exclusion>
<artifactId>javassist</artifactId>
<groupId>javassist</groupId>
</exclusion>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
<exclusion>
<artifactId>jta</artifactId>
<groupId>javax.transaction</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>3.1.0.GA</version>
<exclusions>
<exclusion>
<artifactId>hibernate-commons-annotations</artifactId>
<groupId>org.hibernate</groupId>
</exclusion>
<exclusion>
<artifactId>hibernate-core</artifactId>
<groupId>org.hibernate</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>


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.