-->
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: Could not locate CollectionPersister for role Error
PostPosted: Fri Mar 10, 2017 8:03 am 
Newbie

Joined: Mon May 29, 2006 6:14 am
Posts: 17
Hi,

There are two entities . TblProductopermaster2 entity is parent of TblProductoperwh entity

Code:
/**
* TblProductopermaster generated by hbm2java
*/
@Entity
@Table(name = "TBL_PRODUCTOPERMASTER2")
@Inheritance(strategy=InheritanceType.JOINED)
public class TblProductopermaster2 implements java.io.Serializable {

   private int id;
   private Set<TblData> tblData = new HashSet< TblData >(
         0);

   public TblProductopermaster2() {
   }

   public TblProductopermaster2(int id) {
      this.id = id;
   }

   

   @Id
   @GeneratedValue(generator="increment")
   @GenericGenerator(name="increment", strategy = "increment")
   @Column(name = "ID", unique = true, nullable = false)
   public int getId() {
      return this.id;
   }

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




   @OneToMany(fetch = FetchType.LAZY, mappedBy = "tblDataID")
   public Set<TblData> getTblData() {
      return this.tblDatas;
   }

   public void setTblData(
         Set< TblData > tblDatas) {
      this.tblDatas = tblDatas;
   }
   
}




Code:
@Entity
@Table(name = "TBL_PRODUCTOPERWH")
@PrimaryKeyJoinColumn(name="ID")
@Inheritance(strategy=InheritanceType.JOINED)

public class TblProductoperwh extends TblProductopermaster implements java.io.Serializable {

   

   public TblProductoperwh() {
   }
   
   



}




When below code is running .

Code:
                DetachedCriteria dc = DetachedCriteria.forClass(TblProductoperwh.class);
      
      dc.add(Restrictions.sizeEq("tblData", 0));
      List l = dc.getExecutableCriteria(session).list();;


Error message is occurred

Code:
org.hibernate.MappingException: Could not locate CollectionPersister for role : p1.TblProductoperwh.tblData
   at org.hibernate.metamodel.internal.MetamodelImpl.collectionPersister(MetamodelImpl.java:601)
   at org.hibernate.engine.spi.SessionFactoryImplementor.getCollectionPersister(SessionFactoryImplementor.java:351)
   at org.hibernate.criterion.SizeExpression.toSqlString(SizeExpression.java:40)
   at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:400)
   at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:106)
   at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:75)
   at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:80)
   at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1875)
   at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:366)
   at com.pronit.siminac.mrt.server.server.Server.getAll(Server.java:78)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:4



What is the problem. It is not child class. Why?

When we call for parent class it is ok
Code:
DetachedCriteria dc = DetachedCriteria.forClass(TblProductopermaster2.class);
      
      dc.add(Restrictions.sizeEq("tblData", 0));
      List l = dc.getExecutableCriteria(session).list();;


Thank you


Top
 Profile  
 
 Post subject: Re: Could not locate CollectionPersister for role Error
PostPosted: Sun Mar 12, 2017 3:18 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
What Hibernate version are you using, and you should use the JPA Criteria since the legacy one is considered deprecated.


Top
 Profile  
 
 Post subject: Re: Could not locate CollectionPersister for role Error
PostPosted: Thu Mar 16, 2017 4:13 pm 
Newbie

Joined: Mon May 29, 2006 6:14 am
Posts: 17
We are using last version 5.2.8


Top
 Profile  
 
 Post subject: Re: Could not locate CollectionPersister for role Error
PostPosted: Thu Mar 16, 2017 4:42 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
DetachedCriteria, session,createCriteria are deprecated, so we no longer support them and it will be removed in a future version.

Try it out with JPA Criteria API which we also support.


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.