-->
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.  [ 4 posts ] 
Author Message
 Post subject: [BasicPropertyAccessor] IllegalArgumentException in class:..
PostPosted: Mon Aug 15, 2005 6:02 am 
Newbie

Joined: Fri Aug 12, 2005 7:05 am
Posts: 8
When I perform the following code and I get the IllegalArgumentException on the date field in my server.log (JBoss-4.0.2):

...
InitialContext initCtx = new InitialContext();
SessionFactory sf = (SessionFactory) initCtx.lookup("java:/hibernate/SessionFactory");
Event theEvent = new Event();
theEvent.setTitle(title);
theEvent.setDate(new Date() );
s.save(theEvent);
s.close();
....
---------------------------------------------------------------------------------------
17:54:48,778 ERROR [BasicPropertyAccessor] IllegalArgumentException in class: demo.Event, getter met
hod of property: date
17:54:48,778 INFO [STDOUT] Caught Exception IllegalArgumentException occurred calling getter of dem
o.Event.date
--------------------------------------------------------------------------------------
Event.hbm.xml as following:

<hibernate-mapping>
<class name="demo.Event" table="EVENTS">
<id name="id" column="EVENT_ID">
<generator class="identity"/>
</id>
<property name="date" type="java.util.Date" column="EVENT_DATE"/>
<property name="title"/>

<set name="participants" table="PERSON_EVENT" inverse="true">
<key column="EVENT_ID"/>
<many-to-many column="PERSON_ID" class="demo.Person"/>
</set>
</class>
</hibernate-mapping>
------------------------------------------------------------------------------------------
Event.java as following:

package demo;

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

public class Event {
private Long id;
private String title;
private Date date;
private Set participants = new HashSet();

public Event() {}
public Long getId() {
return id;
}
private void setId(Long id) {
this.id = id;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}

public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
protected Set getParticipants() {
return participants;
}
protected void setParticipants(Set participants) {
this.participants = participants;
}
public void addToParticipant(Person person) {
this.getParticipants().add(person);
person.getEvents().add(this);
}
public void removeFromParticipant(Person person) {
this.getParticipants().remove(person);
person.getEvents().remove(this);
}
}
-------------------------------------------------------------------------------------

I had tried type="timestamp" and type="java.util.Date" in the Event.hbm.xml, both gavesame errors.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 16, 2005 10:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
So what's the stack trace?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 16, 2005 11:33 pm 
Newbie

Joined: Fri Aug 12, 2005 7:05 am
Posts: 8
Hi Steve,

I got the following Stacktrace:
-----------------------------------------------------------------------
-08-17 11:38:02,208 ERROR [org.hibernate.property.BasicPropertyAccessor] IllegalArgumentException in class: demo.Event, getter method of property: id
2005-08-17 11:38:02,228 INFO [STDOUT] org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of demo.Event.id
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:119)
at org.hibernate.tuple.AbstractTuplizer.getIdentifier(AbstractTuplizer.java:103)
at org.hibernate.persister.entity.BasicEntityPersister.getIdentifier(BasicEntityPersister.java:2925)
at org.hibernate.persister.entity.BasicEntityPersister.isTransient(BasicEntityPersister.java:2691)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:408)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:82)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:454)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:449)
at EventManager.createEvent(Unknown Source)
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:324)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
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 org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
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:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
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:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:534)
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:324)
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:105)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 17, 2005 5:55 am 
Newbie

Joined: Fri Aug 12, 2005 7:05 am
Posts: 8
Got my problem solved after reading the following link and follow kaba suggestion.

http://forum.hibernate.org/viewtopic.ph ... texception

It seems JBoss Documentation still need a lot of improvement.


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

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.