-->
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: [Q] Transformers.aliasToBean and Case
PostPosted: Thu Aug 16, 2007 7:56 am 
Newbie

Joined: Fri Jun 24, 2005 3:57 pm
Posts: 11
I am attempting to use the Transformers.aliasToBean functionality to map results from a Names Native SQL query to a DTO bean. This seems to work great as long as the setter methods on my bean are all upper case (ex setMYPROPERTY). Is this just a limitation, a bug or is there a setting somewhere that I need to be specifying to maintain the case?

Thank you in Advance!

Hibernate version: 3.2.4.sp1

Name and version of the database you are using: Oracle 10


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 16, 2007 8:22 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Hibernate takes whatever comes from the database in the resultset, which is not defined. So one solution would be to subclass the Transformer and lowercase it all the time, if that's how you want your properties to look like.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: [Q] Transformers.aliasToBean and Case
PostPosted: Thu Aug 16, 2007 8:58 am 
Newbie

Joined: Fri Jun 24, 2005 3:57 pm
Posts: 11
Thank you for the quick response. I was able to locate another topic on this subject and they suggested specifying a return scalar for the query with the name in the desired case. This seems to have worked.

Thank you!


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 08, 2008 4:08 am 
Newbie

Joined: Mon Aug 15, 2005 9:19 pm
Posts: 8
e.g. something like:

Code:
   <sql-query name="getSomethingStupid">
      <return-scalar column="iLoveYou" type="string"/>
      <![CDATA[
   select word iLoveYou
   from missive
                        where
                        word_type='fluffy_bunnies'
      ]]>
    </sql-query>


with bean:
Code:
class Missive {
    private String iLoveYou;

    public Missive() {}

    public String getILoveYou() {
        return iLoveYou;
    }

    public void setILoveYou() {
        this.iLoveYou = iLoveYou;
    }
}


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.