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.  [ 8 posts ] 
Author Message
 Post subject: net.sf.hibernate.MappingException: No persister for:
PostPosted: Fri Mar 12, 2004 3:00 am 
Newbie

Joined: Tue Mar 09, 2004 8:58 am
Posts: 15
Hi,
I'm new to Hibernate, I'm trying to use Hibernate to save some data into a database table using SunOne app server.
Have done the necessary mappings and (as can be seen from the logs below) Hibernate even picks up the correct mappings. Thereafter on invoking the session.save(applicationPool), it throws up the following exception

    net.sf.hibernate.MappingException: No persister for: eg.ApplicationPool
    at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:344)

    at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2656)
    at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2663)

Some place before this trace the mapping is correctly found

    cfg.Environment - Hibernate 2.1.2
    cfg.Environment - hibernate.properties not found
    cfg.Environment - using CGLIB reflection optimizer
    cfg.Configuration - configuring from resource: /hibernate.cfg.xml
    cfg.Configuration - Configuration resource: /hibernate.cfg.xml
    cfg.Configuration - Mapping resource: eg/ApplicationPool.hbm.xml
    cfg.Binder - Mapping class: eg.ApplicationPool -> application_pool

    cfg.Configuration - Configured SessionFactory: null
    cfg.Configuration - processing one-to-many association mappings
    cfg.Configuration - processing one-to-one association property references
    cfg.Configuration - processing foreign key constraints
    dialect.Dialect - Using dialect: net.sf.hibernate.dialect.OracleDialect
    cfg.SettingsFactory - Use outer join fetching: true


Code:
session = HibernateSession.currentSession();
ApplicationPool applicationPool = new ApplicationPool();
BeanUtils.copyProperties(applicationPool, userPool);
session.save(applicationPool);
session.flush();



Have been trying to figure this out for some time now.
Has anyone had a problem like this before? Could someone please help.
Thanks in advance.
-Ram.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 3:26 am 
Newbie

Joined: Tue Feb 10, 2004 12:03 am
Posts: 16
please post the source code ( your mapping file and beans) and error log


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 3:56 am 
Newbie

Joined: Thu Mar 11, 2004 5:13 am
Posts: 5
In my opinion, you haven't call facade.store() to persitent the object you manuplate to.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 4:02 am 
Newbie

Joined: Tue Mar 09, 2004 8:58 am
Posts: 15
Sorry about missing the mapping files

The hibernate.cfg.xml-

Code:
<hibernate-configuration>

    <session-factory>
        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="hibernate.connection.url">jdbc:oracle:thin:@102.209.183.13:1530:tibdb</property>
        <property name="hibernate.connection.username">chmg</property>
        <property name="hibernate.connection.password">abc</property>
        <property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
        <property name="show_sql">true</property>
        <property name="transaction.factory_class">
             net.sf.hibernate.transaction.JDBCTransactionFactory
        </property>
        <property name="hibernate.cache.provider_class">
             net.sf.hibernate.cache.HashtableCacheProvider
        </property>
        <property name="hibernate.hbm2ddl.auto">update</property>

        <mapping resource="eg/ApplicationPool.hbm.xml"/>

    </session-factory>

</hibernate-configuration>



The ApplicationPool.hbm.xml-

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

  <class name="eg.ApplicationPool" table="application_pool">
    <id name="poolTypeId" column="pool_type_uid" type="string">
         <generator class="uuid.string"/>
    </id>
   <property name="poolName" column="pool_name" type="string"/>
   <property name="poolDesc" column="pool_desc" type="string"/>
   <property name="assignToEmployeePoleInd" column="assign_to_employee_pole_ind" type="string"/>
   <property name="assignToEmployeePNLInd" column="assign_to_employee_pnl_ind" type="string"/>
   <property name="assignToEmployeeSubPNLInd" column="assign_to_employee_subpnl_ind" type="string"/>
   <property name="assignToEmpLocationInd" column="assign_to_emp_location_ind" type="string"/>
   <property name="createdByUid" column="created_By_Uid" type="string"/>
   <property name="creationTS" column="creation_TS" type="timestamp"/>
   <property name="lastUpdatedByUid" column="last_Updated_By_Uid" type="string"/>
   <property name="lastUpdatedByTS" column="last_Updated_By_TS" />
  </class>
 
</hibernate-mapping>



The bean file-

Code:

package eg;
public class ApplicationPool {
   private String poolTypeId;
   private String poolName;
   private Long poolDesc;
   private String assignToEmployeePoleInd;
   private String assignToEmployeePNLInd;
   private String assignToEmployeeSubPNLInd;
   private String assignToEmpLocationInd;
   private String createdByUid;
   private String creationTS;
   private String lastUpdatedByUid;
   private String lastUpdatedByTS;
//getters and setters not listed here
}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 4:14 am 
Newbie

Joined: Tue Mar 09, 2004 8:58 am
Posts: 15
chenxihll wrote:
In my opinion, you haven't call facade.store() to persitent the object you manuplate to.


Facade.store()?
I'm invoking session.save
Code:
session.save(applicationPool);


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 13, 2004 1:22 am 
Newbie

Joined: Tue Mar 09, 2004 8:58 am
Posts: 15
Hi,
I just figured that this fails only when the code is invoked from the application container. As with the code that is invoked from the web container, it works fine.

The layers of the application are thus jsp->Action class->EJB->Java Service class.

When the save is invoked from Action it works fine, but fails when it is invoked from Service.

Does that mean anything?? Please let me know.

Thanks in advance.
-Ram.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 15, 2004 12:27 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Check the logs at a debug level. It will probably help/

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 15, 2004 3:29 pm 
Expert
Expert

Joined: Thu Jan 08, 2004 6:17 pm
Posts: 278
It is probably an error in the way you are initializing your Hibernate session factory inside the EJB container. Carefully study the initialization sequence inside the container.


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