-->
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.  [ 4 posts ] 
Author Message
 Post subject: Derby and hibernate.query.substitutions
PostPosted: Wed Feb 06, 2008 6:04 pm 
Newbie

Joined: Mon Aug 15, 2005 3:43 am
Posts: 15
I have a problem trying to use Derby with Hibernate version:3.2.5.ga
where the hibernate configuration looks like

Code:
<property name="hibernate.connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
       
        <property name="hibernate.connection.url">jdbc:derby:whatson;create=true</property>

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


when I try to execute a query resulted from
Code:
  Disjunction dis = Expression.disjunction();

        if(saturday)
            dis.add(Restrictions.eq("saturday",true));
        if(sunday)
           dis.add(Restrictions.eq("sunday",true));
        if(monday)
            dis.add(Restrictions.eq("monday",true));
        if(tuesday)
            dis.add(Restrictions.eq("tuesday",true));
        if(wednesday)
            dis.add(Restrictions.eq("wednesday",true));
        if(thursday)
            dis.add(Restrictions.eq("thursday",true));
        if (friday)
            dis.add(Restrictions.eq("friday",true));

hibernate does not replace "true " with 1 ( as stated in the hibernate config file and the query fails because Derby does not have boolean type.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 07, 2008 1:10 pm 
Newbie

Joined: Mon Aug 15, 2005 3:43 am
Posts: 15
Does an body have experience with this configuration option of hibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 07, 2008 2:58 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
arashbi wrote:
Does an body have experience with this configuration option of hibernate?



Does it work if you do the same thing in HQL? My quick look at the HB code shows the substitutions are only respected when a HQL is translated, but I might be completely wrong.


Farzad-


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 07, 2008 3:24 pm 
Newbie

Joined: Mon Aug 15, 2005 3:43 am
Posts: 15
As you may noticed it is just a part of the query, and translating the whole query to HQL is really hard.


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