Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: IllegalArgumentException in class ...
PostPosted: Fri Mar 04, 2005 3:35 pm 
Newbie

Joined: Tue May 18, 2004 4:17 pm
Posts: 4
Location: Cypress California
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
Hibernate 2.1.1

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="mypetstore.model.businessobject">
<class name="Order" table="ORDERS">
<id name="orderId" column="ORDERID" unsaved-value="null">
<generator class="assigned"/>
</id>

<property name="username"
column="USERID"
not-null="true"/>

<property name="orderDate"
column="ORDERDATE"
type="date"
not-null="true"/>

<property name="shipAddress1"
column="SHIPADDR1"
not-null="true"/>

<property name="shipAddress2"
column="SHIPADDR2"/>

<property name="shipCity"
column="SHIPCITY"
not-null="true"/>

<property name="shipState"
column="SHIPSTATE"
not-null="true"/>

<property name="shipZip"
column="SHIPZIP"
not-null="true"/>

<property name="shipCountry"
column="SHIPCOUNTRY"
not-null="true"/>

<property name="billAddress1"
column="BILLADDR1"
not-null="true"/>

<property name="billAddress2"
column="BILLADDR2"/>

<property name="billCity"
column="BILLCITY"
not-null="true"/>

<property name="billState"
column="BILLSTATE"
not-null="true"/>

<property name="billZip"
column="BILLZIP"
not-null="true"/>

<property name="billCountry"
column="BILLCOUNTRY"
not-null="true"/>

<property name="courier"
column="COURIER"
not-null="true"/>

<property name="totalPrice"
column="TOTALPRICE"
not-null="true"/>

<property name="billToFirstName"
column="BILLTOFIRSTNAME"
not-null="true"/>

<property name="billToLastName"
column="BILLTOLASTNAME"
not-null="true"/>

<property name="shipToFirstName"
column="SHIPTOFIRSTNAME"
not-null="true"/>

<property name="shipToLastName"
column="SHIPTOLASTNAME"
not-null="true"/>

<property name="creditCard"
column="CREDITCARD"
not-null="true"/>

<property name="expiryDate"
column="EXPRDATE"
not-null="true"/>

<property name="locale"
column="LOCALE"
not-null="true"/>

<set name="lineItems" cascade="all" inverse="true">
<key column="ORDERID"/>
<one-to-many class="LineItem"/>
</set>
</class>
</hibernate-mapping>



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="mypetstore.model.businessobject">
<class name="LineItem" table="LINEITEM">
<id name="lineNumber" column="LINENUM" unsaved-value="null">
<generator class="assigned"/>
</id>

<property name="itemId"
column="ITEMID"
not-null="true"/>

<property name="quantity"
column="QUANTITY"
not-null="true"/>

<property name="unitPrice"
column="UNITPRICE"
not-null="true"/>

<many-to-one name="orderId" class="Order" column="ORDERID"/>

</class>
</hibernate-mapping>



Code between sessionFactory.openSession() and session.close():
I am using Spring.
Here's my app code and classes the saveOrder method is the code that generates the execption:

/*
* MyPetStore Project.
*/
package mypetstore.model.dao.hibernate;

import org.springframework.orm.hibernate.support.HibernateDaoSupport;

import mypetstore.model.dao.OrderDao;
import mypetstore.model.businessobject.Order;
import mypetstore.model.dao.helper.Sequence;

/**
* The Hibernate implementation of the <code>OrderDao</code>
*
* @author <a href="mailto:derek@derekshen.com">Derek Y. Shen</a>
* @see OrderDao
*/
public class OrderDaoHibernateImpl extends HibernateDaoSupport implements OrderDao {
private static final String ORDER_SEQUENCE_NAME = "orderSeq";

public void saveOrder(Order order) {
order.setOrderId(this.getSeqNum(ORDER_SEQUENCE_NAME));
this.getHibernateTemplate().save(order);
}

public Order getOrder(String orderId) {
return (Order)this.getHibernateTemplate().load(Order.class, orderId);
}

private int getSeqNum(String name) {
int seqNum = -1;
Sequence seq = (Sequence)this.getHibernateTemplate().load(Sequence.class, name);
seqNum = seq.getSeqnum();
seq.increment();
this.getHibernateTemplate().update(seq);
return seqNum;
}
}



/*
* MyPetStore Project.
*/
package mypetstore.model.businessobject;

import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Date;

/**
* Order business object.
*
* @author <a href="mailto:derek@derekshen.com">Derek Y. Shen</a>
*/
public class Order {
private int orderId;
private String username;
private Date orderDate;
private String shipAddress1;
private String shipAddress2;
private String shipCity;
private String shipState;
private String shipZip;
private String shipCountry;
private String billAddress1;
private String billAddress2;
private String billCity;
private String billState;
private String billZip;
private String billCountry;
private String courier;
private double totalPrice;
private String billToFirstName;
private String billToLastName;
private String billEmail;
private String billPhone;
private String shipToFirstName;
private String shipToLastName;
private String shipEmail;
private String shipPhone;
private String creditCard;
private String expiryDate;
private String cardType;
private String locale;
private String status;
private Set lineItems;

public Order() {
this.lineItems = new HashSet();
}

public int getOrderId() {
return orderId;
}

public void setOrderId(int newOrderId) {
this.orderId = newOrderId;
}

public String getUsername() {
return username;
}

public void setUsername(String newUsername) {
this.username = newUsername;
}

public Date getOrderDate() {
return orderDate;
}

public void setOrderDate(Date newOrderDate) {
this.orderDate = newOrderDate;
}

public String getShipAddress1() {
return shipAddress1;
}

public void setShipAddress1(String newShipAddress1) {
this.shipAddress1 = newShipAddress1;
}

public String getShipAddress2() {
return shipAddress2;
}

public void setShipAddress2(String shipAddress2) {
this.shipAddress2 = shipAddress2;
}

public String getShipCity() {
return shipCity;
}

public void setShipCity(String newShipCity) {
this.shipCity = newShipCity;
}

public String getShipState() {
return shipState;
}

public void setShipState(String newShipState) {
this.shipState = newShipState;
}

public String getShipZip() {
return shipZip;
}

public void setShipZip(String newShipZip) {
this.shipZip = newShipZip;
}

public String getShipCountry() {
return shipCountry;
}

public void setShipCountry(String newShipCountry) {
this.shipCountry = newShipCountry;
}

public String getBillAddress1() {
return billAddress1;
}

public void setBillAddress1(String newBillAddress1) {
this.billAddress1 = newBillAddress1;
}

public String getBillAddress2() {
return billAddress2;
}

public void setBillAddress2(String newBillAddress2) {
this.billAddress2 = newBillAddress2;
}

public String getBillCity() {
return billCity;
}

public void setBillCity(String newBillCity) {
this.billCity = newBillCity;
}

public String getBillState() {
return billState;
}

public void setBillState(String newBillState) {
this.billState = newBillState;
}

public String getBillZip() {
return billZip;
}

public void setBillZip(String newBillZip) {
this.billZip = newBillZip;
}

public String getBillCountry() {
return billCountry;
}

public void setBillCountry(String newBillCountry) {
this.billCountry = newBillCountry;
}

public String getCourier() {
return courier;
}

public void setCourier(String newCourier) {
this.courier = newCourier;
}

public double getTotalPrice() {
return totalPrice;
}

public void setTotalPrice(double newTotalPrice) {
this.totalPrice = newTotalPrice;
}

public String getBillToFirstName() {
return billToFirstName;
}

public void setBillToFirstName(String newBillToFirstName) {
this.billToFirstName = newBillToFirstName;
}

public String getBillToLastName() {
return billToLastName;
}

public void setBillToLastName(String newBillToLastName) {
this.billToLastName = newBillToLastName;
}

public String getBillEmail() {
return this.billEmail;
}

public void setBillEmail(String newBillEmail) {
this.billEmail = newBillEmail;
}

public String getBillPhone() {
return this.billPhone;
}

public void setBillPhone(String newBillPhone) {
this.billPhone = newBillPhone;
}

public String getShipToFirstName() {
return shipToFirstName;
}

public void setShipToFirstName(String newShipToFirstName) {
this.shipToFirstName = newShipToFirstName;
}

public String getShipToLastName() {
return shipToLastName;
}

public void setShipToLastName(String newShipToLastName) {
this.shipToLastName = newShipToLastName;
}

public String getShipEmail() {
return this.shipEmail;
}

public void setShipEmail(String newShipEmail) {
this.shipEmail = newShipEmail;
}

public String getShipPhone() {
return this.shipPhone;
}

public void setShipPhone(String newShipPhone) {
this.shipPhone = newShipPhone;
}

public String getCreditCard() {
return creditCard;
}

public void setCreditCard(String newCreditCard) {
this.creditCard = newCreditCard;
}

public String getExpiryDate() {
return expiryDate;
}

public void setExpiryDate(String newExpiryDate) {
this.expiryDate = newExpiryDate;
}

public String getCardType() {
return cardType;
}

public void setCardType(String newCardType) {
this.cardType = newCardType;
}

public String getLocale() {
return locale;
}

public void setLocale(String newLocale) {
this.locale = newLocale;
}

public String getStatus() {
return status;
}

public void setStatus(String newStatus) {
this.status = newStatus;
}

public void setLineItems(Set newLineItems) {
this.lineItems = newLineItems;
}

public Set getLineItems() {
return lineItems;
}

public void addLineItem(LineItem lineItem) {
this.lineItems.add(lineItem);
}

/**
* Initialize the current order object based on the information
* inside an account and a shopping cart.
*
* @param account the user account
* @param cart the shopping cart
*/
public void init(Account account, Cart cart) {
this.username = account.getUsername();
this.orderDate = new Date();
this.shipAddress1 = account.getAddress1();
this.shipAddress2 = account.getAddress2();
this.shipCity = account.getCity();
this.shipState = account.getState();
this.shipZip = account.getZip();
this.shipCountry = account.getCountry();
this.billAddress1 = account.getAddress1();
this.billAddress2 = account.getAddress2();
this.billCity = account.getCity();
this.billState = account.getState();
this.billZip = account.getZip();
this.billCountry = account.getCountry();
//hardcode for now
this.courier = "FEDEX";
this.billToFirstName = account.getFirstName();
this.billToLastName = account.getLastName();
this.billEmail = account.getEmail();
this.billPhone = account.getPhone();
this.shipToFirstName = account.getFirstName();
this.shipToLastName = account.getLastName();
this.shipEmail = account.getEmail();
this.shipPhone = account.getPhone();
this.creditCard = account.getCreditCard();
this.expiryDate = account.getExpiryDate();
this.cardType = account.getCardType();
this.locale = account.getLanguagePreference();
//hardcode for now
this.status = "new";

this.totalPrice = cart.getSubTotal();
Iterator ite = cart.getCartItemList().iterator();
int i=1;
while (ite.hasNext()) {
CartItem ci = (CartItem)ite.next();
LineItem item = new LineItem();
item.setLineNumber(i);
item.setItemId(ci.getItem().getItemId());
item.setQuantity(ci.getQuantity());
item.setUnitPrice(ci.getItem().getUnitCost());
this.addLineItem(item);
i++;
}
}
}

/*
* MyPetStore Project.
*/
package mypetstore.model.businessobject;

import java.io.Serializable;

/**
* LineItem business object.
*
* @author <a href="mailto:derek@derekshen.com">Derek Y. Shen</a>
*/
public class LineItem implements Serializable {
private int orderId;
private int lineNumber;
private int quantity;
private String itemId;
private double unitPrice;

public LineItem() {
}

public int getOrderId() {
return orderId;
}

public void setOrderId(int newOrderId) {
this.orderId = newOrderId;
}

public int getLineNumber() {
return lineNumber;
}

public void setLineNumber(int newLineNumber) {
this.lineNumber = newLineNumber;
}

public String getItemId() {
return itemId;
}

public void setItemId(String newItemId) {
this.itemId = newItemId;
}

public double getUnitPrice() {
return unitPrice;
}

public void setUnitPrice(double newUnitprice) {
this.unitPrice = newUnitprice;
}

public int getQuantity() {
return quantity;
}

public void setQuantity(int newQuantity) {
this.quantity = newQuantity;
}

public double getTotalPrice() {
return this.unitPrice * this.quantity;
}

public boolean equals(Object obj) {
if (obj != null) {
if (obj instanceof LineItem) {
return this.orderId == ((LineItem)obj).orderId &&
this.lineNumber == ((LineItem)obj).lineNumber;
}
}

return false;
}

public int hashCode() {
return this.orderId + this.lineNumber;
}
}








Full stack trace of any exception that occurs:
11:13:56,357 DEBUG SecurityFilter:55 - doFilter
11:13:56,357 DEBUG SecurityFilter:59 - url = /createOrder.jsf
11:13:56,357 DEBUG SecurityFilter:60 - query = null
11:13:56,357 DEBUG SecurityFilter:72 - authorization succeeded
11:13:56,388 DEBUG OrderBean:28 - Creating order bean
11:13:56,388 DEBUG OrderBean:46 - Order bean is created
11:13:56,404 DEBUG OrderBean:36 - service locator is set
11:13:56,404 DEBUG OrderBean:55 - createOrderAction is invoked
11:13:56,419 DEBUG SessionImpl:528 - opened session
11:13:56,419 DEBUG JDBCTransaction:37 - begin
11:13:56,419 DEBUG JDBCTransaction:41 - current autocommit status:true
11:13:56,419 DEBUG JDBCTransaction:43 - disabling autocommit
11:13:56,419 DEBUG SessionImpl:1913 - loading [mypetstore.model.dao.helper.Sequence#orderSeq]
11:13:56,419 DEBUG SessionImpl:2010 - attempting to resolve [mypetstore.model.dao.helper.Sequence#orderSeq]
11:13:56,419 DEBUG SessionImpl:2043 - object not resolved in any cache [mypetstore.model.dao.helper.Sequence#orderSeq]
11:13:56,419 DEBUG EntityPersister:417 - Materializing entity: [mypetstore.model.dao.helper.Sequence#orderSeq]
11:13:56,419 DEBUG BatcherImpl:192 - about to open: 0 open PreparedStatements, 0 open ResultSets
11:13:56,419 DEBUG SQL:223 - select sequence0_.NAME as NAME0_, sequence0_.SEQNUM as SEQNUM0_ from SEQUENCE sequence0_ where sequence0_.NAME=?
11:13:56,435 DEBUG BatcherImpl:227 - preparing statement
11:13:56,450 DEBUG StringType:46 - binding 'orderSeq' to parameter: 1
11:13:56,450 DEBUG Loader:196 - processing result set
11:13:56,450 DEBUG Loader:404 - result row: orderSeq
11:13:56,450 DEBUG Loader:535 - Initializing object from ResultSet: orderSeq
11:13:56,450 DEBUG Loader:604 - Hydrating entity: mypetstore.model.dao.helper.Sequence#orderSeq
11:13:56,450 DEBUG IntegerType:68 - returning '1000' as column: SEQNUM0_
11:13:56,450 DEBUG Loader:225 - done processing result set (1 rows)
11:13:56,450 DEBUG BatcherImpl:199 - done closing: 0 open PreparedStatements, 0 open ResultSets
11:13:56,466 DEBUG BatcherImpl:240 - closing statement
11:13:56,466 DEBUG Loader:238 - total objects hydrated: 1
11:13:56,466 DEBUG SessionImpl:2129 - resolving associations for [mypetstore.model.dao.helper.Sequence#orderSeq]
11:13:56,466 DEBUG SessionImpl:2153 - done materializing entity [mypetstore.model.dao.helper.Sequence#orderSeq]
11:13:56,466 DEBUG SessionImpl:3000 - initializing non-lazy collections
11:13:56,466 DEBUG SessionImpl:1275 - object already associated with session
11:13:56,482 DEBUG SessionImpl:786 - saving [mypetstore.model.businessobject.Order#1000]
11:13:56,497 DEBUG Cascades:497 - processing cascades for: mypetstore.model.businessobject.Order
11:13:56,497 DEBUG Cascades:506 - done processing cascades for: mypetstore.model.businessobject.Order
11:13:56,497 DEBUG Cascades:497 - processing cascades for: mypetstore.model.businessobject.Order
11:13:56,497 DEBUG Cascades:524 - cascading to collection: mypetstore.model.businessobject.Order.lineItems
11:13:56,497 DEBUG Cascades:113 - cascading to saveOrUpdate()
11:13:56,497 DEBUG Cascades:341 - id unsaved-value strategy NULL
11:13:56,497 DEBUG SessionImpl:1326 - saveOrUpdate() previously saved instance with id: 1
11:13:56,497 DEBUG SessionImpl:1374 - updating [mypetstore.model.businessobject.LineItem#1]
11:13:56,497 DEBUG Cascades:506 - done processing cascades for: mypetstore.model.businessobject.Order
11:13:56,497 INFO HibernateTransactionManager:315 - Initiating transaction commit
11:13:56,497 DEBUG JDBCTransaction:59 - commit
11:13:56,513 DEBUG SessionImpl:2193 - flushing session
11:13:56,513 DEBUG Cascades:497 - processing cascades for: mypetstore.model.businessobject.Order
11:13:56,513 DEBUG Cascades:524 - cascading to collection: mypetstore.model.businessobject.Order.lineItems
11:13:56,513 DEBUG Cascades:113 - cascading to saveOrUpdate()
11:13:56,513 DEBUG SessionImpl:1306 - saveOrUpdate() persistent instance
11:13:56,513 DEBUG Cascades:506 - done processing cascades for: mypetstore.model.businessobject.Order
11:13:56,529 DEBUG SessionImpl:2321 - Flushing entities and processing referenced collections
11:13:56,529 DEBUG AbstractEntityPersister:278 - mypetstore.model.dao.helper.Sequence.seqnum is dirty
11:13:56,529 DEBUG SessionImpl:2415 - Updating entity: [mypetstore.model.dao.helper.Sequence#orderSeq]
11:13:56,529 DEBUG WrapVisitor:76 - Wrapped collection in role: mypetstore.model.businessobject.Order.lineItems
11:13:56,529 DEBUG SessionImpl:2768 - Collection found: [mypetstore.model.businessobject.Order.lineItems#1000], was: [<unreferenced>]
11:13:56,529 DEBUG SessionImpl:2415 - Updating entity: [mypetstore.model.businessobject.LineItem#1]
11:13:56,529 DEBUG SessionImpl:2664 - Processing unreferenced collections
11:13:56,544 DEBUG SessionImpl:2678 - Scheduling collection removes/(re)creates/updates
11:13:56,544 DEBUG SessionImpl:2217 - Flushed: 1 insertions, 2 updates, 0 deletions to 3 objects
11:13:56,544 DEBUG SessionImpl:2222 - Flushed: 1 (re)creations, 0 updates, 0 removals to 1 collections
11:13:56,544 DEBUG Printer:75 - listing entities:
11:13:56,560 ERROR BasicPropertyAccessor:106 - IllegalArgumentException in class: mypetstore.model.businessobject.Order, getter method of property: orderId
11:13:56,560 DEBUG JDBCTransaction:82 - rollback
11:13:56,560 DEBUG SessionImpl:558 - transaction completion
11:13:56,560 DEBUG JDBCTransaction:103 - re-enabling autocommit
11:13:56,560 DEBUG SessionImpl:546 - closing session
11:13:56,560 DEBUG SessionImpl:3187 - disconnecting session
11:13:56,560 DEBUG SessionImpl:558 - transaction completion
11:13:56,560 ERROR InvokeApplicationPhase:80 - #{orderBean.createOrderAction}: javax.faces.el.EvaluationException: org.springframework.orm.hibernate.HibernateSystemException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId; nested exception is net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId
javax.faces.FacesException: #{orderBean.createOrderAction}: javax.faces.el.EvaluationException: org.springframework.orm.hibernate.HibernateSystemException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId; nested exception is net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:266)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:380)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at mypetstore.view.util.SecurityFilter.doFilter(SecurityFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.faces.el.EvaluationException: org.springframework.orm.hibernate.HibernateSystemException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId; nested exception is net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
... 24 more
Caused by: org.springframework.orm.hibernate.HibernateSystemException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId; nested exception is net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId
at org.springframework.orm.hibernate.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:304)
at org.springframework.orm.hibernate.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:503)
at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:398)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:316)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:189)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:148)
at $Proxy2.saveOrder(Unknown Source)
at mypetstore.view.bean.OrderBean.createOrderAction(OrderBean.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
... 25 more
Caused by: net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId
at net.sf.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:110)
at net.sf.hibernate.persister.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:310)
at net.sf.hibernate.proxy.HibernateProxyHelper.getIdentifier(HibernateProxyHelper.java:50)
at net.sf.hibernate.type.EntityType.toString(EntityType.java:84)
at net.sf.hibernate.impl.Printer.toString(Printer.java:49)
at net.sf.hibernate.impl.Printer.toString(Printer.java:82)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2228)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2186)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:386)
... 36 more
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at net.sf.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:96)
... 45 more
11:13:56,622 ERROR StandardWrapper[/mypetstore:Faces Servlet]:269 - Servlet.service() for servlet Faces Servlet threw exception
javax.faces.FacesException: #{orderBean.createOrderAction}: javax.faces.el.EvaluationException: org.springframework.orm.hibernate.HibernateSystemException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId; nested exception is net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:266)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:380)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at mypetstore.view.util.SecurityFilter.doFilter(SecurityFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.faces.el.EvaluationException: org.springframework.orm.hibernate.HibernateSystemException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId; nested exception is net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
... 24 more
Caused by: org.springframework.orm.hibernate.HibernateSystemException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId; nested exception is net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId
at org.springframework.orm.hibernate.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:304)
at org.springframework.orm.hibernate.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:503)
at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:398)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:316)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:189)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:148)
at $Proxy2.saveOrder(Unknown Source)
at mypetstore.view.bean.OrderBean.createOrderAction(OrderBean.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
... 25 more
Caused by: net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of mypetstore.model.businessobject.Order.orderId
at net.sf.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:110)
at net.sf.hibernate.persister.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:310)
at net.sf.hibernate.proxy.HibernateProxyHelper.getIdentifier(HibernateProxyHelper.java:50)
at net.sf.hibernate.type.EntityType.toString(EntityType.java:84)
at net.sf.hibernate.impl.Printer.toString(Printer.java:49)
at net.sf.hibernate.impl.Printer.toString(Printer.java:82)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2228)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2186)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:386)
... 36 more
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at net.sf.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:96)
... 45 more



Name and version of the database you are using:
MySql 4.1.7

The generated SQL (show_sql=true):
This exception is prior to the generated SQL.

Debug level Hibernate log excerpt:
### Hibernate logging options
log4j.logger.net.sf.hibernate = debug

_________________
Thanks for your time,
Tom


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.