-->
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: how to enable 'initialize on demand'
PostPosted: Fri Feb 24, 2006 1:32 pm 
Newbie

Joined: Fri Feb 24, 2006 1:09 pm
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1.2

I have an hibernate entity DAO object, which has lots of properties set to null, and a primary key has been allocated through its constructor. Is there any way to persist it to a DB row and set all of the null fields to "initialize on demand", *WITHOUT calling the database*?

I'm using a DAO as its own query return bean, and the above problem is holding me back from constructing queries that return partially populated DAO's! (using reflection and varArgs in super constructors etc)

Thanks guys!

-Adam


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 3:26 pm 
Expert
Expert

Joined: Mon Jan 09, 2006 5:01 pm
Posts: 311
Location: Sacramento, CA
Use a UserType

for some reason the "default" settings in my property tags don't take hold...I haven't figured it out yet - I recall reading that you need to set the values from your java code...now the question is "why?"... if there is a provision in hibernate for "default" values why doesn't hibernate set them. I suppose you could always initialize the fields in your class, ie:
String name="bob"; for the 'name' property.

_________________
-JT

If you find my replies helpful, please rate by clicking 'Y' on them. I appreciate it.


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.