-->
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.  [ 1 post ] 
Author Message
 Post subject: Not-null (on property in the .hbm.xml file)and it's behavior
PostPosted: Tue Jun 28, 2005 1:12 pm 
Beginner
Beginner

Joined: Thu Mar 31, 2005 5:59 pm
Posts: 34
Hibernate version:
3.0

Mapping documents:
Excerpt (names rewritten to protect the innocent):
....
<property name="otherTableField"
column="NUMBER"
type="string"
formula="( SELECT other.otherField FROM schema.otherTable other WHERE substr(number, 1, (length(number)-5)) = other.connectingField )"/>
....

Name and version of the database you are using:
DB2 v8.1.0.16 FixPak 2

The generated SQL (show_sql=true):
Excerpted again (names changed again):
select * from ( select ...., ( SELECT other.otherField FROM schema.otherTable other WHERE substr(firsttable_.number, 1, (length(firsttable_.number)-5)) = other.connectingField ) as formula0_ from otherschema.firsttable firsttable_ where (...) ) as temp_ where rownumber_ <= ?


Ok, so my question is, I'd like to only retrieve these objects (we'll call them firsttableobjects) when a value exists in otherTableField. That is, I only want to retrieve them when otherTableField is not null. I saw the property non-null, but I wasn't sure if this is what it was meant for.

The big key here is that I cannot modify any of these tables in the DB. So I saw that not-null was talking about DDL and it got me scared. Does anyone know if using not-null will change the DB? And if not, will it do what I want?

Thanks!
Susan


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.