-->
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: Autonumbering
PostPosted: Mon Aug 18, 2008 6:53 am 
Newbie

Joined: Mon Aug 18, 2008 6:34 am
Posts: 1
Hi,

I have following entity
@Entity
public class Test implements Serializable {
@Id
@GeneratedValue(....)
private Long id;
private Long idx;
}

I need to implement some mechanism which autoincrement idx field.
Is there any way to autonumbering non-primarykey entity field??


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 20, 2008 4:00 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

at which times do you want to autoincrement? Maybe @PreUpdate or @PrePersist event handlers are something you can use. It all depends on your usecase.

--Hardy


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.