-->
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.  [ 4 posts ] 
Author Message
 Post subject: Use of GenericGenerator
PostPosted: Fri Mar 02, 2007 3:39 am 
Newbie

Joined: Fri Feb 02, 2007 6:55 am
Posts: 8
Can I use GenericGenerator on non-id property?

I would like to write a custom generator, which supposed the nextHi
value is backed by a table.

Is it doable?

Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 07, 2007 8:05 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
no

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 08, 2007 10:15 pm 
Newbie

Joined: Fri Feb 02, 2007 6:55 am
Posts: 8
So, I a have one entity Alarm:

Code:
public class Alarm {
    @Id
    @GeneratedValue
    public int getSystemId() {
        // normal auto-generated primary key
    }
    public Client getOwner() {
    }
    public String alarmId() {
    }
}


Each Client will own a set of Alarm, each client want to reference
the alarm with one unique alarmId (however, the set of alarmId for
two diff. client will intersect).

So, in Database, example of possible data is
systemId ownerId alarmId
1 1 ALM000001
2 1 ALM000002
3 2 ALM000001

Is there any good way to handle the 'alarmId' generation?
Is this criteria / req common in other apps?

Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 6:42 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you could use a custom type to handle the id into 2 columns and use a custom generator, it might work.

_________________
Emmanuel


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