-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: regression between 3.2.2 and 3.2.3 related to HHH-252?
PostPosted: Mon Sep 03, 2007 2:38 pm 
Code that was working in 3.2.2, now throws a null pointer in 3.2.3 after bug HHH-252 was fixed.

In the stack trace belowe, a FixedLoanDepositInstrumentEty instance is created and merged. The embedded contractRef is null.
When the new code in TypeFactory.replaceAssociations() gets executed, there is an attempt to get field values from the null component, which leads eventually to the exception.

Hibernate version:3.2.3
Hibernate annotations version:3.3.0
Hibernate entity manager version:3.3.1

Mapping documents:

@Entity
@Table(name = "Tbl_Fixed_Loan_Deposit")
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
public class FixedLoanDepositInstrumentEty extends LoanDepositInstrumentEty {

private static final long serialVersionUID = 8899569824112964052L;

@Temporal(TemporalType.DATE)
@Column(name = "Dt_Maturity")
private Date maturityDate;

@ManyToOne(cascade = { PERSIST, MERGE, REFRESH })
@JoinColumn(name = "Id_Duration_Def")
private DurationDefinitionEty durationDef;

@MappedSuperclass
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
public abstract class LoanDepositInstrumentEty extends InstrumentEty {

private static final long serialVersionUID = 3924898550785802471L;

@Column(name = "Cd_Loan_Deposit_Style", nullable = false)
private String style;

@Column(name = "Cd_Loan_Deposit_Type", nullable = false)
private String type;

@Temporal(TemporalType.DATE)
@Column(name = "Dt_Start")
private Date startDate;

@Column(name = "Rt_Interest")
private BigDecimal interestRate;

@Embedded
private ContractRefEty contractRef;

@Embeddable
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
public class ContractRefEty implements Serializable {

private static final long serialVersionUID = -8645025351223018512L;

@Column(name = "Cd_Type_Contract_Ref")
private String type;

@Column(name = "No_Contract_Ref")
private String value;

Code between sessionFactory.openSession() and session.close():

FixedLoanDepositInstrumentEty fixedLoanDepositInst = new FixedLoanDepositInstrumentEty(FIDUCIARY, DEPOSIT,
cashInst,
startCal.getTime(),
maturityCal.getTime(),
duration);
fixedLoanDepositInst = (FixedLoanDepositInstrumentEty) em.merge(fixedLoanDepositInst);

Full stack trace of any exception that occurs:

javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.lodh.position.instrument.entity.ContractRefEty.type
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630)
at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:237)
...
Caused by: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.lodh.position.instrument.entity.ContractRefEty.type
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:35)
at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValue(AbstractComponentTuplizer.java:64)
at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValues(AbstractComponentTuplizer.java:70)
at org.hibernate.tuple.component.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:83)
at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:353)
at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:348)
at org.hibernate.type.TypeFactory.replaceAssociations(TypeFactory.java:535)
at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:366)
at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:195)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:123)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:665)
at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:228)
... 29 more
Caused by: java.lang.NullPointerException
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:36)
at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:18)
at java.lang.reflect.Field.get(Field.java:357)
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:32)
... 43 more

Name and version of the database you are using: Hsqldb 1.8.0

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.