-->
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: Custom Id Generator - Number of instances created?
PostPosted: Mon Dec 04, 2006 12:23 pm 
Newbie

Joined: Mon Dec 04, 2006 12:04 pm
Posts: 1
Hibernate version: 3.1

Name and version of the database you are using: mySql 5

Hi,

I'm using a custom identifier generator e.g.

<generator class="com.blah.foo.MyIdentifierGenerator">
</generator>

I use this custom generator for more than one entity i.e. the above tag is used in multiple .hbm.xml files that each map a unique Java class to a [unique] table.

Question:
If I use the above tag in N .hbml.xml files, then how many instances of MyIdentifierGenerator are created?

In my testing I see N instances are created, but I'd like to verify from someone who may know for sure. I hope to have a separate instance of the custom generator for each .hbm.xml file using the custom generator.

I suppose I could look in the source code, but I'm hoping to save that as a last resort.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 10:49 am 
Newbie

Joined: Fri Apr 28, 2006 11:26 am
Posts: 8
Location: Vancouver, WA
I just created a custom id generator myself, one which takes different parameters for each mapped class. I verified that each instance had the correct parameters when instantiated, so I think it's safe to say that a new instance is created for each mapped class.

Hope this helps!

Tim


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.