简体   繁体   中英

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 ???

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") .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM