-->
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.  [ 1 post ] 
Author Message
 Post subject: IllegalArgumentException occurred calling getter of app.pers
PostPosted: Fri Sep 09, 2011 6:23 am 
Newbie

Joined: Sun Jun 12, 2011 1:43 pm
Posts: 10
Please help me with this one...

The error's source is at line return q.list();
Code:
Query q = getSession().createQuery("from "+getGenericClassName()+" as c where c in (:subList)");
      q.setParameterList("subList", subList);
      System.out.println(q.toString());
      [b]return q.list();[/b]

DBBook class
Code:
package app.persist;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name=DBBook.tablename)
public class DBBook {
   
   public static final String tablename ="books";
   
   private Long id;
   private String name;
   private String type;
   private Integer nr_pages;
   private Float price;
   @Id
   @GeneratedValue
   public Long getId() {
      return id;
   }
   
   public String getType() {
      return type;
   }
   
   @Column(nullable = false)
   public Float getPrice() {
      return price;
   }
   
   
   public Integer getNr_pages() {
      return nr_pages;
   }
   
   @Column(nullable= false, unique=true)
   public String getName() {
      return name;
   }
   
   public void setType(String type) {
      this.type = type;
   }
   public void setPrice(Float price) {
      this.price = price;
   }
   public void setNr_pages(Integer nr_pages) {
      this.nr_pages = nr_pages;
   }
   public void setName(String name) {
      this.name = name;
   }
   public void setId(Long id) {
      this.id = id;
   }
   
}


The stack trace
Code:
QueryImpl(from app.persist.DBBook as c where c in (:subList))
Hibernate:
    /*
from
    app.persist.DBBook as c
where
    c in (
        :subList
    ) */ select
        dbbook0_.id as id2_,
        dbbook0_.name as name2_,
        dbbook0_.nr_pages as nr3_2_,
        dbbook0_.price as price2_,
        dbbook0_.type as type2_
    from
        books dbbook0_
    where
        dbbook0_.id in (
            ? , ? , ? , ? , ? , ? , ? , ? , ? , ?
        )
Sep 9, 2011 12:13:40 PM com.sun.faces.context.ExceptionHandlerImpl log
SEVERE: JSF1073: javax.faces.event.AbortProcessingException caught during processing of PROCESS_VALIDATIONS 3 : UIComponent-ClientId=j_idt30:j_idt32, Message=/app/cat/books.xhtml @17,51 valueChangeListener="#{books.changeSize}": org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of app.persist.DBBook.id
Sep 9, 2011 12:13:40 PM com.sun.faces.context.ExceptionHandlerImpl log
SEVERE: /app/cat/books.xhtml @17,51 valueChangeListener="#{books.changeSize}": org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of app.persist.DBBook.id
javax.faces.event.AbortProcessingException: /app/cat/books.xhtml @17,51 valueChangeListener="#{books.changeSize}": org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of app.persist.DBBook.id
   at javax.faces.event.MethodExpressionValueChangeListener.processValueChange(MethodExpressionValueChangeListener.java:157)
   at javax.faces.event.ValueChangeEvent.processListener(ValueChangeEvent.java:134)
   at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:777)
   at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:752)
   at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1167)
   at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
   at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
   at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of app.persist.DBBook.id
   at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:198)
   at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:227)
   at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3875)
   at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3583)
   at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:203)
   at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:242)
   at org.hibernate.type.EntityType.getIdentifier(EntityType.java:456)
   at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:130)
   at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:67)
   at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:571)
   at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1716)
   at org.hibernate.loader.Loader.doQuery(Loader.java:801)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
   at org.hibernate.loader.Loader.doList(Loader.java:2533)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
   at org.hibernate.loader.Loader.list(Loader.java:2271)
   at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
   at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
   at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
   at app.dao.ResultPager.nextPage(ResultPager.java:31)
   at app.BooksBean.getNext(BooksBean.java:41)
   at app.BooksBean.changeSize(BooksBean.java:53)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
   at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
   at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
   at javax.faces.event.MethodExpressionValueChangeListener.processValueChange(MethodExpressionValueChangeListener.java:144)
   ... 23 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(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:172)
   ... 54 more


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