Код работает правильно на JBoss 5.1, но не работает на JBoss 7: неправильное количество столбцов

Тот же код работал на JBoss 5.1. При попытке перейти на JBoss 7.1 я получаю следующую ошибку.

Caused by: org.hibernate.AnnotationException: A Foreign key refering com.domain.admin.test.User from com.domain.admin.test.TestDeskGroupPermission has the wrong number of column. should be 2
    at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:421)
    at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:111)

Мои сущности ниже. Обратите внимание, что нет составных первичных ключей.

@Entity
@Table(name = "Users")
@Auditable
public class User extends AbstractVersionedEntity implements Serializable 
{
@Override
@Id
@Column(name = "ID")
public Long getId()
{
return super.getId();
}

@OneToMany(mappedBy = "owner", cascade = CascadeType.ALL)
@XmlTransient
@Where(clause = SoftDelete.ACTIVE_JPQL)
@BatchSize(size = BATCH_DESKS)
public Set<TestDeskGroupPermission> getDeskGroupPermissions()
{
    return this.deskGroupPermissions;
}
public void setDeskGroupPermissions(final Set<TestDeskGroupPermission> deskGroupPermissions)
{
    this.deskGroupPermissions = deskGroupPermissions;
}
}

@Entity
@Table(name = "TestDeskGroupPermission")
@Auditable
public class TestDeskGroupPermission implements Serializable
{
private User                owner;
private TestGroupPermission deskGroupPermission;

@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "User_ID")
@XmlTransient
public User getOwner()
{
    return this.owner;
}

public void setOwner(final User owner)
{
    this.owner = owner;
}

@Embedded
@XmlTransient
public TestGroupPermission getDeskGroupPermission()
{
    return this.deskGroupPermission;
}

public void setDeskGroupPermission(final TestGroupPermission  eskGroupPermission)
{
    this.deskGroupPermission = deskGroupPermission;
}

}

@MappedSuperclass
@XmlTransient
public abstract class AbstractVersionedEntity extends AbstractBaseEntity implements VersionedEntity
{
@Override
@Id
@Column(name = "ID")
@XmlTransient
public Long getId()
{
    return super.getId();
}
}

@MappedSuperclass
@XmlTransient
public abstract class AbstractBaseEntity implements BaseEntity, Modifiable,Serializable
{
private Long id;
public AbstractBaseEntity()
{

}
@Override
@Transient
@XmlTransient
public Long getId()
{
    return this.id;
}

@Override
public void setId(final Long id)
{
    this.id = id;
}
}

0 ответов

Другие вопросы по тегам