-->
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.  [ 7 posts ] 
Author Message
 Post subject: HELP: ORACLE BOOLEAN SUBSTITUTIONS (WRONG SOLUTION)
PostPosted: Mon Jan 29, 2007 9:49 am 
Newbie

Joined: Tue Dec 19, 2006 5:25 am
Posts: 9
Hello,

I am using Oracle 9i Database. Oracle doesn't let BOOLEAN type, but we want to convert VARCHAR2(5) ,in Database, for boolean in our POJOs.

I have read the reference documentation, and it advices this:
Code:
<property name="hibernate.query.substitutions">true "true", false "false"</property>


But, when I run the application, the error below is showed:

Code:
2007-01-29 14:40:31,958 INFO  [main](NullableType.java:132) - could not read column value from result set: LOCKED5_0_; Fallo al convertir a representación interna


Any ideas?

Thanks in advance.

Best regards.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 6:55 pm 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Did you try writing a custom UserType? This is very easy to write and very straightforward to use. See http://www.hibernate.org/hib_docs/v3/re ... pes-custom IMO this is typically a use case for a UserType (storing something with special processing).

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject: Query Substitution
PostPosted: Tue Jan 30, 2007 7:24 am 
Beginner
Beginner

Joined: Thu Apr 07, 2005 5:12 pm
Posts: 27
Location: Hamburg
I used this for Oracle 9i and 10g and it works fine.

<property name="hibernate.query.substitutions">true 1, false 0</property>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 30, 2007 4:19 pm 
Newbie

Joined: Tue Dec 19, 2006 5:25 am
Posts: 9
Many thanks, I have changed the type in my Oracle Database to NUMBER.

And the substitution works fine!

Syntax below:

Code:
<property name="hibernate.query.substitutions">true 1, false 0</property>


Thanks again.

Best regards.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 31, 2007 7:02 am 
Newbie

Joined: Tue Dec 19, 2006 5:25 am
Posts: 9
Hi,

After all, I want to know why the substitution works fine in the case:

Code:
<property name="hibernate.query.substitutions">true 1, false 0</property>


And it doesn't work fine in the case:

Code:
<property name="hibernate.query.substitutions">true "true", false "false"</property>


Is it a bug?

Thanks in advance.

Best regards.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 31, 2007 7:42 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
As it is substitutions in query, try :
Code:
<property name="hibernate.query.substitutions">true 'true', false 'false'</property>

instead

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 31, 2007 5:12 pm 
Newbie

Joined: Tue Dec 19, 2006 5:25 am
Posts: 9
I tried it, and the ways below:

Code:
<property name="hibernate.query.substitutions">true " 'true' ", false " 'false' "</property>


But in Oracle 9i it doesn't work fine. It must be a bug. Maybe, Hibernate architects can explain that. Any ideas?

Many thanks for your advice.

Best regards.


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