Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Column(length=1000000)
- @Lob
- private String notes;
- <property name="hibernate.hbm2ddl.auto" value="update" />
- import javax.persistence.Column;
- import javax.persistence.Entity;
- import javax.persistence.GeneratedValue;
- import javax.persistence.Id;
- import javax.persistence.Lob;
- import javax.persistence.NamedQuery;
- import javax.persistence.Table;
- @Entity
- @Table( name = "usr" )
- public class User {
- @Id
- @GeneratedValue
- private Long id;
- @Column( length = 40, unique = true )
- private String name;
- @Lob
- @Column( length = 100000 )
- private String text;
- public long getId() {
- return id;
- }
- public void setName( String name ) {
- this.name = name;
- }
- public String getName() {
- return name;
- }
- public String getText() {
- return text;
- }
- public void setText( String text ) {
- this.text = text;
- }
- }
- <persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
- version="2.0">
- <persistence-unit name="jpatest" transaction-type="RESOURCE_LOCAL">
- <properties>
- <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
- <property name="hibernate.hbm2ddl.auto" value="update"/>
- <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
- <property name="hibernate.connection.username" value="root"/>
- <property name="hibernate.connection.password" value="root"/>
- <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/jpadatabase"/>
- <property name="hibernate.show-sql" value="true"/>
- </properties>
- </persistence-unit>
- </persistence>
- .....
- @Column( length = 255 )
- private String text;
- ......
- DEBUG SchemaExport:415 - drop table if exists usr
- DEBUG SchemaExport:415 - create table usr (id bigint not null auto_increment, name varchar(40) unique, text varchar(255), primary key (id)) ENGINE=InnoDB
- INFO SchemaExport:281 - schema export complete
- .....
- @Lob
- @Column( length = 100000 )
- private String text;
- .......
- DEBUG SchemaExport:415 - drop table if exists usr
- DEBUG SchemaExport:415 - create table usr (id bigint not null auto_increment, name varchar(40) unique, text longtext, primary key (id)) ENGINE=InnoDB
- INFO SchemaExport:281 - schema export complete
- INFO TableMetadata:65 - table found: jpadatabase.usr
- INFO TableMetadata:66 - columns: [id, text, name]
- INFO TableMetadata:68 - foreign keys: []
- INFO TableMetadata:69 - indexes: [name, primary]
- DEBUG DefaultIdentifierGeneratorFactory:90 - Setting dialect [org.hibernate.dialect.MySQL5InnoDBDialect]
- INFO SchemaUpdate:217 - schema update complete
- DEBUG SchemaUpdate:203 - alter table usr add column location varchar(255)
- INFO SchemaUpdate:217 - schema update complete
- ALTER TABLE piece_aud MODIFY notes LONGTEXT;
- ALTER TABLE piece_aud MODIFY notes LONGTEXT;
- <property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/>
- alter table your_table modify column your_column text
- @Type(type="org.hibernate.type.StringClobType")
- String message;
- @Column(name="your_column_name",columnDefinition="LONGTEXT")
- private String notes;
Add Comment
Please, Sign In to add comment