[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5677?page=c...
]
Marcial Atienzar commented on HHH-5677:
---------------------------------------
I've resolved it with this code:
{code}
@ManyToOne(fetch=FetchType.LAZY,cascade=CascadeType.REFRESH)
@JoinColumnsOrFormulas(
{@JoinColumnOrFormula(
formula=(a)JoinFormula(value="RRHH.PCK_UTIL.f_dp_num_de_clavepro(CLAVE_PRO)",referencedColumnName
= "NUM"))}
)
private RhDatosPersonales upcRrhh;
{code}
Problem with ManyToOne to a unique key on merge when old value is
null
----------------------------------------------------------------------
Key: HHH-5677
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5677
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Affects Versions: 3.6.0
Reporter: Marcial Atienzar
*Entity 1*:
{code}
@ManyToOne(fetch=FetchType.LAZY,cascade=CascadeType.REFRESH)
@JoinColumn(name = "UPC", referencedColumnName =
"CLAVE_PRO",unique=false,insertable=false,updatable=false)
private RhDatosPersonales upcRrhh;
{code}
*Entity 2*:
{code}
@Id
@Column(name = "NUM", nullable = false)
private BigDecimal num;
@Column(name =
"CLAVE_PRO",unique=true,insertable=false,updatable=false,nullable=true)
private Long clavePro;
{code}
*Exception*
{code}
Caused by: java.lang.ClassCastException: org.kyrian.entity.rrhh.RhDatosPersonales cannot
be cast to java.math.BigDecimal
at
org.hibernate.type.descriptor.java.BigDecimalTypeDescriptor.areEqual(BigDecimalTypeDescriptor.java:36)
at
org.hibernate.type.AbstractStandardBasicType.isEqual(AbstractStandardBasicType.java:183)
at
org.hibernate.type.AbstractStandardBasicType.isSame(AbstractStandardBasicType.java:168)
at
org.hibernate.type.AbstractStandardBasicType.isDirty(AbstractStandardBasicType.java:213)
at
org.hibernate.type.AbstractStandardBasicType.isDirty(AbstractStandardBasicType.java:205)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:268)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:277)
at org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:296)
at
org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:3378)
at
org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:520)
at
org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:230)
at
org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:154)
at
org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
at
org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
at
org.hibernate.transaction.synchronization.CallbackCoordinator.beforeCompletion(CallbackCoordinator.java:117)
{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira