I'm trying to map a OneToOne relationship in a legacy database. The problem I have is that I keep getting the following error:
javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: LocationID, expected: tinyint at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:737) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127) at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)...
@Entity
@Table(name="tblAccountManager")
public class AccountManager implements Serializable {
...
@OneToOne
@JoinColumn(name="LocationID")
private Branch branch;@Entity
@Table(name="web_location")
@Name("Branch")
public class Branch implements Serializable {
private static final long serialVersionUID = -7280892867401735383L;
@Id @GeneratedValue
@Column(name = "Loc_ID")
@org.hibernate.annotations.Type(type = "custom.hibernate.IntegerToByteUserType")
private Integer id;