-->
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.  [ 14 posts ] 
Author Message
 Post subject: anybody have idea? plz~ help!
PostPosted: Mon May 29, 2006 6:22 pm 
Newbie

Joined: Tue May 02, 2006 12:09 am
Posts: 8
Hibernate version:
3.1.3

Mapping documents:
Regulation.hbm.xml
<hibernate-mapping>
<class name="regulation.regulation.Regulation" table="regulations_tbl">
<id name="id" type="integer">
<column name="id" sql-type="Number(5)"/>
<generator class="assigned" />
</id>
<property name="no" type="integer"/>
<property name="rdate" type="date"/>
<property name="title" type="string"/>
<property name="dptname" type="string"/>
<property name="volumes" type="string"/>
<property name="edate" type="date"/>
<property name="reorganize" type="string"/>
<property name="supplement" type="string"/>
<property name="note" type="string"/>
<property name="filename" type="string"/>
<property name="type" column="class" type="string"/>
</class>
</hibernate-mapping>

Regulation.java
package regulation.regulation;

import java.util.Date;

public class Regulation
{
private Integer id;
private Integer no;
private Date rdate;
private String title;
private String dptname;
private String volumes;
private Date edate;
private String reorganize;
private String supplement;
private String note;
private String filename;
private String type;

public Regulation()
{
super();
}

public void setId(Integer id)
{
this.id = id;
}

public Integer getId()
{
return id;
}

public void setNo(Integer no)
{
this.no = no;
}

public Integer getNo()
{
return no;
}

public void setRdate(Date rdate)
{
this.rdate = rdate;
}

public Date getRdate()
{
return rdate;
}

public void setTitle(String title)
{
this.title = title;
}

public String getTitle()
{
return title;
}

public void setDptname(String dptname)
{
this.dptname = dptname;
}

public String getDptname()
{
return dptname;
}

public void setVolumes(String volumes)
{
this.volumes = volumes;
}

public String getVolumes()
{
return volumes;
}

public void setEdate(Date edate)
{
this.edate = edate;
}

public Date getEdate()
{
return edate;
}

public void setReorganize(String reorganize)
{
this.reorganize = reorganize;
}

public String getReorganize()
{
return reorganize;
}

public void setSupplement(String supplement)
{
this.supplement = supplement;
}

public String getSupplement()
{
return supplement;
}

public void setNote(String note)
{
this.note = note;
}

public String getNote()
{
return note;
}

public void setFilename(String filename)
{
this.filename = filename;
}

public String getFilename()
{
return filename;
}

public void setType(String type)
{
this.type = type;
}

public String getType()
{
return type;
}
}

Full stack trace of any exception that occurs:
2006-05-29 18:14:39,375 ERROR [org.hibernate.property.BasicPropertyAccessor] - IllegalArgumentException in class: regulation.regulation.Regulation, getter method of property: id
2006-05-29 18:14:39,375 DEBUG [org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] - Applying rules to determine whether transaction should rollback on org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of regulation.regulation.Regulation.id
2006-05-29 18:14:39,375 DEBUG [org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] - Winning rollback rule is: null
2006-05-29 18:14:39,375 DEBUG [org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] - No relevant rollback rule found: applying superclass default
2006-05-29 18:14:39,375 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] - Invoking rollback for transaction on regulation.regulation.RegulationDao.getRegulationList due to throwable [org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of regulation.regulation.Regulation.id]
2006-05-29 18:14:39,375 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Triggering beforeCompletion synchronization
2006-05-29 18:14:39,375 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Initiating transaction rollback
2006-05-29 18:14:39,375 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Rolling back Hibernate transaction on Session [org.hibernate.impl.SessionImpl@1fc]
2006-05-29 18:14:39,390 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Triggering afterCompletion synchronization
2006-05-29 18:14:39,390 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] - Clearing transaction synchronization
2006-05-29 18:14:39,390 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] - Removed value [org.springframework.orm.hibernate3.SessionHolder@203] for key [org.hibernate.impl.SessionFactoryImpl@204] from thread [ApplicationServerThread-0]
2006-05-29 18:14:39,390 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Resetting read-only flag of JDBC Connection [512(oracle.jdbc.driver.T4CConnection@201)]
2006-05-29 18:14:39,390 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Closing Hibernate Session [org.hibernate.impl.SessionImpl@1fc] after transaction
2006-05-29 18:14:39,390 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] - Closing Hibernate Session
2006-05-29 18:14:39,390 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Cleared thread-bound request context: com.evermind.server.http.EvermindHttpServletRequest@1f9
2006-05-29 18:14:39,390 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Could not complete request
org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of regulation.regulation.Regulation.id
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171)
at org.hibernate.tuple.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:176)
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3257)
at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:2983)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:181)
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:215)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:108)
at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:77)
................................
................................
................................
Caused by: java.lang.IllegalArgumentException: this is not an instance of the method's owning class
Name and version of the database you are using:
oracle 9i


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 7:20 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
That's an awesome request for help. No text, just code with no code tags. Thank you for putting effort into helping me find your problem, and I hope noone ever asks you a question like that.

Anyway, I think that your problem is that you've defined the type of the id to be "integer", which maps to the primitive int type. But you've defined id in your POJO to be java.lang.Integer. Change the type in the mapping to java.lang.Integer, see if that helps.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 9:01 pm 
Newbie

Joined: Tue May 02, 2006 12:09 am
Posts: 8
I am really sorry about it.

I have tried java.lang.Integer but it still doesn't works.

I am using oracle9i and ID column type is number(5).

thanks for your reply.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 9:42 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Normally when I see that exception it's due to composite-ids being used, but some incorrect class being returned from the getId() method. Seeing as that doesn't apply here, we'll have to do some investigation.

Next thing to try is to switch Integer to int. Seeing as it's a PK, it can't ever be null, so the change should work. Change your POJO to use "int id" instead of "Integer id", and change the corresponding getId and setId methods. Leave the mapping just like you posted it above (type="integer").

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 10:10 pm 
Newbie

Joined: Tue May 02, 2006 12:09 am
Posts: 8
thanks tenwit, but it's still give a same error.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 10:18 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Closer inspection of your exception shows that this happened inside a many-to-one set method. You haven't done anything like 'many-to-one property-ref="id"', have you? id isn't a property, it's the id, so you can't reference it in a property-ref attribute. If that's you've done, delete the property-ref in the many-to-one, and it'll use the id.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 10:31 pm 
Newbie

Joined: Tue May 02, 2006 12:09 am
Posts: 8
thanks, I haven't done anything like 'many-to-one property-ref="id".


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 10:48 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Well find all many-to-one associations from other mappings to Regulation, and double-check them for potential mistakes. The ultimate problem is that Regulation.getId(), having been retrieved using reflection, is being called with a non-Regulation object (method.invoke(wrongObject, null)). You need to find out where and why that's happening. It might be obvious from the exception (you cut out all the interesting and useful bits, find the original and follow the stack traces to the top). If not, just start commenting out many-to-one associations to Regulation until you find the one that causes the error.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 11:56 pm 
Newbie

Joined: Tue May 02, 2006 12:09 am
Posts: 8
well, i don't have any other mappings. Regulation is the only one.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 12:00 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
So how did you get "org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:77)" to appear in your stack trace? There are no associations in Regulation, so I had assumed that something else must have an association to it.

Perhaps you should post the entire stack trace, including all "caused by" clauses. Don't forget to use code tags.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 12:49 am 
Newbie

Joined: Tue May 02, 2006 12:09 am
Posts: 8
Code:
package common;

import java.util.Iterator;
import java.util.List;

import java.util.Map;

import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.Session;

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

import regulation.config.PathSet;

import regulation.regulation.Regulation;

public class BaseHibernateDaoSupport extends HibernateDaoSupport
{

    protected List getPagedList(String queryName, Map parameterMap, int page, Class className)
    {
        Session session = getSessionFactory().openSession();
        Query query = session.createQuery(queryName);
        Iterator iter = (parameterMap.entrySet().iterator());
        Map.Entry entry = null;
        while(iter.hasNext())
        {
            entry = (Map.Entry)iter.next();
            query.setParameter((String)entry.getKey(), entry.getValue(),
                               Hibernate.entity(Regulation.class));
        }
        query.setFirstResult((page - 1) * pageSize).setMaxResults(pageSize);
        return query.list();
    }
}


it's causes me an error.

and I don't get any errors with this code:
query.setParameter((String)entry.getKey(), entry.getValue())[/i][/b];

and this is my entire stack trace
Code:
2006-05-30 15:14:52,953 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@4c1] in DispatcherServlet with name 'NavyRegulation'
2006-05-30 15:14:52,953 DEBUG [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] - Looking up handler for [/viewRegulation1.html]
2006-05-30 15:14:52,953 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Testing handler adapter [org.springframework.web.servlet.mvc.SimpleRequestHandlerAdapter@4c2]
2006-05-30 15:14:52,953 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Testing handler adapter [org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter@4c3]
2006-05-30 15:14:52,953 DEBUG [org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver] - Returning handler method name 'viewRegulation1Handler' for lookup path: /viewRegulation1.html
2006-05-30 15:14:52,953 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Last-Modified value for [/NavyRegulation/viewRegulation1.html] is [-1]
2006-05-30 15:14:52,953 DEBUG [org.springframework.web.servlet.DispatcherServlet] - DispatcherServlet with name 'NavyRegulation' received request for [/NavyRegulation/viewRegulation1.html]
2006-05-30 15:14:52,968 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Bound request context to thread: com.evermind.server.http.EvermindHttpServletRequest@4c4
2006-05-30 15:14:52,968 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Testing handler adapter [org.springframework.web.servlet.mvc.SimpleRequestHandlerAdapter@4c2]
2006-05-30 15:14:52,968 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Testing handler adapter [org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter@4c3]
2006-05-30 15:14:52,968 DEBUG [org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver] - Returning handler method name 'viewRegulation1Handler' for lookup path: /viewRegulation1.html
2006-05-30 15:14:52,984 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] - Getting transaction for regulation.regulation.RegulationDao.getRegulationList
2006-05-30 15:14:53,000 INFO [org.springframework.jdbc.datasource.JdbcTransactionObjectSupport] - JDBC 3.0 Savepoint class is available
2006-05-30 15:14:53,000 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Using transaction object [org.springframework.orm.hibernate3.HibernateTransactionManager$HibernateTransactionObject@4c6]
2006-05-30 15:14:53,000 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Creating new transaction with name [regulation.regulation.RegulationDao.getRegulationList]
2006-05-30 15:14:53,031 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Opened new Session [org.hibernate.impl.SessionImpl@4c7] for Hibernate transaction
2006-05-30 15:14:53,031 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Preparing JDBC Connection of Hibernate Session [org.hibernate.impl.SessionImpl@4c7]
2006-05-30 15:14:53,046 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Setting JDBC Connection [1227(oracle.jdbc.driver.T4CConnection@4cc)] read-only
2006-05-30 15:14:53,046 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] - Bound value [org.springframework.orm.hibernate3.SessionHolder@4ce] for key [org.hibernate.impl.SessionFactoryImpl@4cf] to thread [ApplicationServerThread-0]
2006-05-30 15:14:53,046 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] - Initializing transaction synchronization
2006-05-30 15:14:53,296 DEBUG [org.hibernate.SQL] - select * from ( select regulation0_.id as id0_, regulation0_.class as class0_ from regulations_tbl regulation0_ where regulation0_.class=? order by no ) where rownum <= ?
2006-05-30 15:14:53,656 ERROR [org.hibernate.property.BasicPropertyAccessor] - IllegalArgumentException in class: regulation.regulation.Regulation, getter method of property: id
2006-05-30 15:14:53,671 DEBUG [org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] - Applying rules to determine whether transaction should rollback on org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of regulation.regulation.Regulation.id
2006-05-30 15:14:53,671 DEBUG [org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] - Winning rollback rule is: null
2006-05-30 15:14:53,671 DEBUG [org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] - No relevant rollback rule found: applying superclass default
2006-05-30 15:14:53,671 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] - Invoking rollback for transaction on regulation.regulation.RegulationDao.getRegulationList due to throwable [org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of regulation.regulation.Regulation.id]
2006-05-30 15:14:53,671 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Triggering beforeCompletion synchronization
2006-05-30 15:14:53,671 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Initiating transaction rollback
2006-05-30 15:14:53,671 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Rolling back Hibernate transaction on Session [org.hibernate.impl.SessionImpl@4c7]
2006-05-30 15:14:53,671 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Triggering afterCompletion synchronization
2006-05-30 15:14:53,671 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] - Clearing transaction synchronization
2006-05-30 15:14:53,671 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] - Removed value [org.springframework.orm.hibernate3.SessionHolder@4ce] for key [org.hibernate.impl.SessionFactoryImpl@4cf] from thread [ApplicationServerThread-0]
2006-05-30 15:14:53,671 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Resetting read-only flag of JDBC Connection [1227(oracle.jdbc.driver.T4CConnection@4cc)]
2006-05-30 15:14:53,671 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] - Closing Hibernate Session [org.hibernate.impl.SessionImpl@4c7] after transaction
2006-05-30 15:14:53,671 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] - Closing Hibernate Session
2006-05-30 15:14:53,671 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Cleared thread-bound request context: com.evermind.server.http.EvermindHttpServletRequest@4c4
2006-05-30 15:14:53,687 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Could not complete request
org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of regulation.regulation.Regulation.id
   at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171)
   at org.hibernate.tuple.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:176)
   at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3257)
   at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:2983)
   at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:181)
   at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:215)
   at org.hibernate.type.EntityType.getIdentifier(EntityType.java:108)
   at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:77)
   at org.hibernate.loader.hql.QueryLoader.bindNamedParameters(QueryLoader.java:491)
   at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1577)
   at org.hibernate.loader.Loader.doQuery(Loader.java:661)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
   at org.hibernate.loader.Loader.doList(Loader.java:2145)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
   at org.hibernate.loader.Loader.list(Loader.java:2024)
   at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
   at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:307)
   at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
   at common.BaseHibernateDaoSupport.getPagedList(BaseHibernateDaoSupport.java:36)
   at regulation.regulation.RegulationDaoImpl.getRegulationList(RegulationDaoImpl.java:25)
   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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:288)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:100)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
   at $Proxy3.getRegulationList(Unknown Source)
   at regulation.controller.RegulationController.viewRegulation1Handler(RegulationController.java:44)
   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 org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:433)
   at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:371)
   at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
   at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:45)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:796)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:727)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:351)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
   at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
   at regulation.KoreanFilter.doFilter(KoreanFilter.java:31)
   at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:629)
   at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
   at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
   at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
   at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
   at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
   at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
   at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
   at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
   at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
   at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
   at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
   at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalArgumentException: this is not an instance of the method's owning 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 org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:145)
   ... 62 more
2006-05-30 15:14:53,687 DEBUG [org.springframework.web.context.support.XmlWebApplicationContext] - Publishing event in context [WebApplicationContext for namespace 'NavyRegulation-servlet']: ServletRequestHandledEvent: url=[/NavyRegulation/viewRegulation1.html]; client=[32.1.22.129]; method=[GET]; servlet=[NavyRegulation]; session=[null]; user=[null]; time=[734ms]; status=[failed: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of regulation.regulation.Regulation.id]
2006-05-30 15:14:53,687 DEBUG [org.springframework.web.context.support.XmlWebApplicationContext] - Publishing event in context [Root WebApplicationContext]: ServletRequestHandledEvent: url=[/NavyRegulation/viewRegulation1.html]; client=[32.1.22.129]; method=[GET]; servlet=[NavyRegulation]; session=[null]; user=[null]; time=[734ms]; status=[failed: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of regulation.regulation.Regulation.id]


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 5:30 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
I'm afraid that that doesn't help me find where the many-to-one is, and the exception is pretty clear that the problem lies in getting the ID from a Regulation that's in a many-to-one association. Also, I've never used Hibernate.entity(), and if omitting it makes your code work, then I suggest doing that.

Incidentally, you have some odd code in there that you might want to think about. You use getSessionFactory().openSession() without a corresponding closeSession(). Isn't that going to cause signification resource leakage? Shouldn't you be using a single session to handle the entire request, rather than getting a new session just for this paged list?

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 7:55 am 
Regular
Regular

Joined: Tue May 16, 2006 3:32 am
Posts: 117
I think the reason why you are getting the above exception is because entry.getValue() is not an object of type Regulation.

Consider the following code :

Assume there is a Regulation with id = 1 in the database.

Regulation regulation = new Regulation();
regulation.setId(new Integer(1));

Query q = s.createQuery("from Regulation where id = :id");
q.setParameter("id", regulation, Hibernate.entity(Regulation.class));
// This should work

if entry.getValue() is of type String then use
q.setParameter("id", "1", Hibernate.STRING);

for Integer
q.setParameter("id", new Integer(1), Hibernate.INTEGER);
or since id is of type Integer directly use q.setParameter("id", new Integer(1));


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 01, 2006 5:04 am 
Newbie

Joined: Tue May 02, 2006 12:09 am
Posts: 8
thanks, JayeshJ and tenwit.
The problem is solved. JayeshJ was right.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 14 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.