Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I was using Hibernate 3.6 where I have a code like this:

list =getSession().createSQLQuery(queryString)
        .addScalar("UNAME",Hibernate.STRING)
        .addScalar("COM",Hibernate.STRING)
        .addScalar("COM_DATE",Hibernate.DATE) 
        .setString("id", Id).list();

now I change the jar from 3.6 to 4.1Final

it seems like the addScalar method is askying for Type in stead of Hibernate.STRING I couldn't find any example hot to resolve this. if there is anyone that who know please help me thank you.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
134 views
Welcome To Ask or Share your Answers For Others

1 Answer

Type fields in org.hibernate.Hibernate are deprecated (and actually removed) as result of HHH-5196

Now different Hibernate types can be found from javadocs for Type. In your case following should work:

    .addScalar("UNAME", StringType.INSTANCE)
    .addScalar("COM", StringType.INSTANCE)
    .addScalar("COM_DATE", DateType.INSTANCE) 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...