50

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.

1 Answer 1

69

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) 
Sign up to request clarification or add additional context in comments.

1 Comment

Instead of Hibernate.STRING one can use StandardBasicTypes.STRING also, the value is the same (StringType.INSTANCE), maybe this one is easier for merge ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.