Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate mapping oracle char

 
Ajai
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have db field of type char(4).
I use hibernate to get this particular field .
The type specified in hibernate file is as below

<property name="abc" type="string">
<column name="abc" length="4" />
</property>


I also tried giving sql-type=char(4).
I used createSQLQuery method of hibernate session to get this value .
But I get only the first character of the field value.
Can anybody suggest why?

Thanks
Ajai
 
Travis Hein
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does the Java bean that you map to define the property 'abc' as a java String?

The Java char primative, or java.lang.Character class still only old one character.

I found that char(s) in the datbase map to java.lang.String, or "text" types in hibernate.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic