struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kropp, Henning" <hkr...@microlution.de>
Subject Hibernate UserType and OGNL
Date Thu, 14 Aug 2008 12:16:07 GMT
Hi,

I am trying to implement a hibernate UserType for all the monetary 
amounts in my application. I follow the example given in "Manning - Java 
Persistence with Hibernate" Chapter 5.3 .
I am having difficulties to set and retrieve the value from a jsp due to 
a lack of understanding how this is handled. I assume it is related to OGNL.

Basically I am trying the following:
addBid.jsp:
<s:textfield key="bid.amount" /> ( also tried: <s:textfield 
key="bid.amount.amount" /> )

Mapping:
@org.hibernate.annotations.Type ( type= 
"com.app.persistence.MonetaryUserType" )
@Column( name="amount" )
public Monetary getAmount() { return amount; }

and Monetary beeing:
public class Monetary implements Serializable{
    private final BigDecimal amount;
    private final Currency currency;

    public Monetary(BigDecimal amount, Currency currency) {
        this.amount = amount;
        this.currency = currency;
    }

    public BigDecimal getAmount() { return amount; }
    public Currency getCurrency() { return currency; }

I am getting either a field error or with "bid.amount.amount" :
ERROR [btpool0-2] InstantiatingNullHandler.nullPropertyValue(110) | 
Could not create and/or set value back on to object
java.lang.InstantiationException: com.app.model.Monetary

What am I doing wrong? What is this 
InstantiatingNullHandler.nullPropertyValue and how to trac it down?

Thanks and kind regards

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message