[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Entity Inheritence with primitive datatypes causes a Propert

gecco do-not-reply at jboss.com
Sat Feb 23 07:41:16 EST 2008


hi,
when using entity inheritence with jboss 4.2.2 the EntityManager.find() call  causes a org.hibernate.PropertyAccessException when called on superclass type and the subclass contains a field of primitive type.
For example, i have two entities Person and Employee

  | @Entity
  | @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
  | public class Person implements Serializable{	
  |         @Id
  | 	@Column(name="ID", nullable=false)
  | 	private int id;
  | 	
  | 	@Column(name="NAME", nullable=false)
  | 	private String name;
  |         // getter and setter.....
  | }
  | 
  | @Entity
  | public class Employee extends Person implements Serializable {	
  | 	
  | 	@Column(name="SSN", nullable=false)
  | 	private int ssn;
  | 	//getter and setter
  | 	
  | }
  | 

now after persisting a Employee a call on entityManager.find(Person.class, id) will result in a PropertyAccessException:
Caused by: javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of org.example.entity.Employee.ssn
the value in the database is not null, and it worked fine with JbossAS 4.0.5

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131628#4131628

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131628



More information about the jboss-user mailing list