-->
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: Manual setting ID of class with assigned generator.
PostPosted: Tue Aug 30, 2005 10:31 pm 
Newbie

Joined: Tue Jul 12, 2005 6:55 pm
Posts: 9
Hi there,

I've go one problem - I'd like to be able to use both 'worlds' of setting IDs of my POJO classess. I would like to have it automatically generated BUT if I will save class with ID already set - I'd like that predefined ID to be used...

Is it possible? What's the easiest way to do this on MySQL?

---------------- reason for such need ---------------

I have application generating data in database. Thera are classes like SomeObjectStatusType containing "constants" used by SomeObject. Through application IDs of those constants are set as final static properties of AppConstants class.


Top
 Profile  
 
 Post subject: yes
PostPosted: Wed Aug 31, 2005 2:31 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
yes, it is possible. Simply assign the necessary ID and then call session.save( theObject );

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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.