Hi all. I have problem:
my class:
@Entity
@Table(name = "productTable")
@javax.persistence.TableGenerator(name = "contentGen", table = "contentIdGen", pkColumnName = "keyCol", valueColumnName = "val", pkColumnValue = "content")
public class Product {
private Long id;
private String name;
private Long contentId;
......
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long getId() {
return id;
}
.....
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "contentGen")
public long getContentId() {
return contentId;
}
.....
.....
}
When I create my class product and save it into DB i getting this error:
Hibernate: insert into productTable (id, name) values (null, ?)
16:57:11,874 WARN [JDBCExceptionReporter] SQL Error: -10, SQLState: 23000
16:57:11,875 ERROR [JDBCExceptionReporter] Attempt to insert null into a non-nullable column: column: CONTENTID table: PRODUCTTABLE in statement [insert into productTable (id, name) values (null, ?)]
org.hibernate.exception.ConstraintViolationException: could not insert...
In error stack trace i'm not view contentId field name -> (productTable (id, name))
Hibernate version:
3.2.6GA
Name and version of the database you are using:
HSQLDB 1.8.0.7 (for tests) and MSSQL 2005
|