Saturday, December 28, 2013

org.hibernate.MappingException: Could not determine type for: String, at table: Persons, for columns: [org.hibernate.mapping.Column(FirstName)]

org.hibernate.MappingException: Could not determine type for: String, at table: Persons, for columns: [org.hibernate.mapping.Column(FirstName)]

Problem:  
In Mapping, the type what you specified that the first character will be in Upper case. In the above exception, type will be String.

Solution: 
In hibernate mapping file, use type string instead of String because in hibernate, the type will be case sensitive.

Java type
Mapping type
ANSI SQL Type
int or java.lang.Integer
integer
INTEGER
long or java.lang.Long
long
BIGINT
short or java.lang.Short
short
SMALLINT
float or java.lang.Float
float
FLOAT
double or java.lang.Double
double
DOUBLE
java.math.BigDecimal
big_decimal
NUMERIC
java.lang.String
character
CHAR(1)
java.lang.String
string
VARCHAR
byte or java.lang.Byte
byte
TINYINT
boolean or java.lang.Boolean
boolean
BIT
boolean or java.lang.Boolean
yes/no
CHAR(1) ('Y' or 'N')
boolean or java.lang.Boolean
true/false
CHAR(1) ('T' or 'F')

1 comments:

hitesh said...

thanx bhai,you don't know how big help did you to me
your article is most useful for me
thanx again a lot