Hello everyone,
I am trying to get a list of article resources and i am getting the following exception:
Code:
com.elnominal.exception.InfrastructureException: org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of com.elnominal.model.resource.ArticleResource.resourceCategory
at com.elnominal.dao.ArticleDAO.findAll(ArticleDAO.java:110)
at com.elnominal.servlet.SearchDataFilter.doFilter(SearchDataFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.elnominal.servlet.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:104)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of com.elnominal.model.resource.ArticleResource.resourceCategory
at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:104)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:337)
at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:200)
at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3571)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:133)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854)
at org.hibernate.loader.Loader.doQuery(Loader.java:729)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1994)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:63)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:454)
at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:844)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:241)
at org.hibernate.loader.Loader.doList(Loader.java:2213)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at com.elnominal.dao.ArticleDAO.findAll(ArticleDAO.java:108)
... 16 more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
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:597)
at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:42)
... 38 more
this is my hbm file for ArticleResource:
Code:
<hibernate-mapping package="com.elnominal.model.resource">
<class name="ArticleResource" table="elnominal_article_resource" lazy="true">
<id name="id" type="integer" column="id" unsaved-value="null">
<generator class="sequence">
<param name="sequence">elnominal_article_resource_id_seq</param>
</generator>
</id>
<property name="title" type="string" column="title" length="40" not-null="true" unique-key="UNIQUE_NAME_AT_LEVEL"/>
<property name="description" type="string" column="description" length="200" not-null="false"/>
<property name="fileName" type="string" column="file_name" length="200" not-null="false"/>
<property name="filePath" type="string" column="file_path" length="200" not-null="false"/>
<property name="creationDate" column="creation_date" type="java.util.Date" update="false" not-null="true"/>
<many-to-one name="resourceCategory" cascade="none" class="com.elnominal.model.category.ResourceCategory" column="id_category" not-null="false" />
</class>
</hibernate-mapping>
and my ArticleResource class:
Code:
...
private int id = 0;
private String title = null;
private String description = null;
private String fileName;
private String filePath;
private Date creationDate = new Date();
private ResourceCategory resourceCategory = null;
public ArticleResource() {}
public String getTitle() { return this.title; }
public void setTitle(String title) { this.title = title; }
public String getDescription() { return this.description; }
public void setDescription(String description) { this.description = description; }
public String getFileName() { return this.fileName; }
public void setFileName(String fileName) { this.fileName = fileName; }
public String getFilePath() { return this.filePath; }
public void setFilePath(String filePath) { this.filePath = filePath; }
public Date getCreationDate() { return this.creationDate; }
public void setCreationDate(Date creationDate) { this.creationDate = creationDate; }
public ResourceCategory getResourceCategory() { return this.resourceCategory; }
public void setResourceCategory(ResourceCategory resourceCategory) { this.resourceCategory = resourceCategory; }
...
Can someone help me? i am really stuck at this,
Thanks in advance