-->
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.  [ 6 posts ] 
Author Message
 Post subject: Promblem with formula mapping and is null
PostPosted: Thu May 19, 2005 4:58 pm 
Beginner
Beginner

Joined: Thu Feb 17, 2005 4:20 pm
Posts: 29
I have the following as a mapping element:

<property name="activeParticipantCount" type="int" lazy="true" >
<formula>( select count(*) from participant_employer pe, participant p
where pe.employer_id = EMPLOYER_ID and pe.termination_date is null
and pe.user_id = p.user_id and p.status = 'active' )
</formula>
</property>

The sql genereated by hibernate is :

Hibernate: select [...other field removed...] ( select count(*) from participant_employer pe, participant p
where pe.employer_id = employer0_.EMPLOYER_ID and pe.termination_date is employer0_.null
and pe.user_id = p.user_id and p.status = 'active' )
as formula1_ from EMPLOYER employer0_

How do I get hibernate to generate "pe.termination_date is null" instead of "pe.termination_date is employer0_.null"?

The query as hibernate generates causes a jdbc exception: java.sql.SQLException: ORA-00908: missing NULL keyword


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 23, 2005 1:42 pm 
Beginner
Beginner

Joined: Thu Feb 17, 2005 4:20 pm
Posts: 29
Ok here is the scoop....

In my formula query above, if I put a space after the is null clause, "is null ", then it works. However, if there is no space, "is null", then I get the above descriped error.

Should this be in the JIRA system?


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 23, 2005 1:44 pm 
Beginner
Beginner

Joined: Thu Feb 17, 2005 4:20 pm
Posts: 29
And yes, I do have a carriage return after the "is null" in my mapping file.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 23, 2005 1:46 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
have you tried CDATA?

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 23, 2005 2:04 pm 
Beginner
Beginner

Joined: Thu Feb 17, 2005 4:20 pm
Posts: 29
I wrapped it in a CDATA tag, and the behavior still exists. I need to have a space after the "is null".


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 23, 2005 3:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
OK, looks like Template.renderWhereStringTemplate() is not considering a carriage return as whitespace. I'll fix that.


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