Cascade delete on one-to-one fail with "could not get a field value by reflection getter of .."

Description

Two classes with relation one-to-to. When deleting exception is thrown.
After degrade relation on one-to-many all get worked.

---------First ---------------
@IdClass(DOGaa_subjekt_dopln.DOGaa_subjekt_doplnPk.class)
@MappedSuperclass
public abstract class DOGaa_subjekt_dopln extends DOParent implements DOHistorizableMain {
...
/**

  • OneToOne
    */
    @OneToOne(mappedBy="one_aa_subjekt_dopln")
    protected DOaa_subjekt one_aa_subjekt;
    @IgnoreProperty
    public DOaa_subjekt getOneDOaa_subjekt() { return this.one_aa_subjekt; }
    public void setOneDOaa_subjekt(DOaa_subjekt aa_subjekt) { this.one_aa_subjekt = aa_subjekt; }

@Embeddable
public static class DOGaa_subjekt_doplnPk implements Serializable {
protected Integer id_pripad;

public Integer getId_pripad() {
return id_pripad;
}
public void setId_pripad(Integer id_pripad) {
this.id_pripad = id_pripad;
}
protected Integer id_partner;

public Integer getId_partner() {
return id_partner;
}
public void setId_partner(Integer id_partner) {
this.id_partner = id_partner;
}
...
}
}

---------Second ---------------
@XmlType(name="DOaa_subjekt",namespace="http://aa.ws.daisy.marbes.cz")
@IdClass(DOGaa_subjekt.DOGaa_subjektPk.class)
@MappedSuperclass
public abstract class DOGaa_subjekt extends DOParent implements DOHistorizableMain {
....

/**

  • OneToOne
    */
    @OneToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
    @JoinColumns({
    @JoinColumn(name="id_partner", referencedColumnName="id_partner", unique=false, nullable=false, insertable=false, updatable=false),
    @JoinColumn(name="id_pripad", referencedColumnName="id_pripad", unique=false, nullable=false, insertable=false, updatable=false)
    })
    protected DOaa_subjekt_dopln one_aa_subjekt_dopln;
    @IgnoreProperty
    public DOaa_subjekt_dopln getOneDOaa_subjekt_dopln() { return this.one_aa_subjekt_dopln; }
    public void setOneDOaa_subjekt_dopln(DOaa_subjekt_dopln aa_subjekt_dopln) { this.one_aa_subjekt_dopln = aa_subjekt_dopln; }

@Embeddable
public static class DOGaa_subjektPk implements Serializable {
protected Integer id_pripad;

public Integer getId_pripad() {
return id_pripad;
}
public void setId_pripad(Integer id_pripad) {
this.id_pripad = id_pripad;
}
protected Integer id_partner;

public Integer getId_partner() {
return id_partner;
}
public void setId_partner(Integer id_partner) {
this.id_partner = id_partner;
}
...
}
}

----------------Exception----------------- 2006-08-03 12:04:58,289 WARN http-8090-Processor2ubal [BLKernel3] Exception invoking fellowship kernel3.editforms.savedelta
org.springframework.orm.hibernate3.HibernateSystemException: could not get a field value by reflection getter of cz.marbes.daisy.modules.aa.mdo.DOGaa_subjekt_dopln$DOGaa_subjekt_doplnPk.id_pripad; nested exception is org.hibernate.PropertyAccessException: could not get a field value by reflection getter of cz.marbes.daisy.modules.aa.mdo.DOGaa_subjekt_dopln$DOGaa_subjekt_doplnPk.id_pripad
org.hibernate.PropertyAccessException: could not get a field value by reflection getter of cz.marbes.daisy.modules.aa.mdo.DOGaa_subjekt_dopln$DOGaa_subjekt_doplnPk.id_pripad
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:35)
at org.hibernate.tuple.AbstractComponentTuplizer.getPropertyValue(AbstractComponentTuplizer.java:61)
at org.hibernate.tuple.AbstractComponentTuplizer.getPropertyValues(AbstractComponentTuplizer.java:67)
at org.hibernate.tuple.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:98)
at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:307)
at org.hibernate.type.ComponentType.getHashCode(ComponentType.java:158)
at org.hibernate.engine.EntityKey.generateHashCode(EntityKey.java:103)
at org.hibernate.engine.EntityKey.<init>(EntityKey.java:47)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:76)

------------------RESEARCH --------- In hibernate is wrong assigned Entity with his IdClass.
For DOaa_subjekt_dopln there is key DOaa_subjekt_doplnPk
but
for entity DOaa_subjekt there is key DOaa_subjekt_doplnPk too!!

Or should I generated just one IdClass for all one-to-one entities ??

Environment

None

Assignee

Unassigned

Reporter

Jara Cesnek

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure