Hibernate @DiscriminatorColumn and @DiscriminatorValue issue

Posted by user224270 on Stack Overflow See other posts from Stack Overflow or by user224270
Published on 2010-06-03T14:32:10Z Indexed on 2010/06/03 15:44 UTC
Read the original article Hit count: 308

Filed under:
|

I have this parent class:

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "BSEntity")
@DiscriminatorColumn(name = "resourceType", discriminatorType = DiscriminatorType.STRING, length = 32)
public abstract class BaseEntity {

and the subclass

@Entity
@Table(name = "BSCategory")
@DiscriminatorValue("Category")
public class CategoryEntity extends BaseEntity {

But when I run the program, I get the following error:

2010-06-03 10:13:54,222 [main] WARN  (org.hibernate.util.JDBCExceptionReporter:100) - SQL Error: 1364, SQLState: HY000
2010-06-03 10:13:54,222 [main] ERROR (org.hibernate.util.JDBCExceptionReporter:101) - Field 'resourceType' doesn't have a default value

Any thoughts?

Updated: Database is MySQL. I have also changed inheritance strategy to JOINED instead of SINGLE_TABLE. Help

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about jpa