ManMohan Vyas
ManMohan Vyas

Reputation: 4062

How to define my own mapping between java to database Object

Is these some Way to define my own mapping of hibernate to database Object?? For example, by default String maps to varchar(45), I want to change it to TEXT or just varchar(245) , what are the ways of achieving it ???

Upvotes: 1

Views: 111

Answers (1)

Mateusz
Mateusz

Reputation: 3048

You can use either

<property name="description" type="string">
    <column name="description" length="100" />
</property>

in xml or

@Column(name="description", length=100)

annotation in class.

Alternatively, you can use @Type annotation - for more info see this or this.

You probably want to use @Type(type="text").

Upvotes: 1

Related Questions