1 Reply Latest reply on Oct 28, 2004 8:02 PM by Mark LaPolla

    Hibernate2 + JBoss : a problem with persisters

    Mark LaPolla Newbie

      I tried to modify eg to persist the Cat class. When I call save on my session I get this error:

       [java] net.sf.hibernate.MappingException: No persister for: org.hibernate.a
      uction.Cat
       [java] at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(Session
      FactoryImpl.java:347)
       [java] at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionIm
      pl.java:2690)
       [java] at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.ja
      va:2697)
       [java] at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier
      (SessionImpl.java:763)
       [java] at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
       [java] at org.hibernate.auction.Main.viewAllAuctionsFast(Main.java:50)
       [java] at org.hibernate.auction.Main.main(Main.java:384)
       [java] Exception in thread "main"
      


      My Cat.hbm.xml looks like this:

      <?xml version="1.0"?>
      <!DOCTYPE hibernate-mapping
       PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
       "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
      
      <hibernate-mapping package="org.hibernate.auction">
      
       <import class="Cat"/>
      
       <class name="Cat" table="CAT">
      
       <!-- A 32 hex character is our surrogate key. It's automatically
       generated by Hibernate with the UUID pattern. -->
       <id name="id" type="string" unsaved-value="null" >
       <column name="CAT_ID" sql-type="char(32)" not-null="true"/>
       <generator class="native"/>
       </id>
      
       <!-- A cat has to have a name, but it shouldn' be too long. -->
       <property name="name">
       <column name="NAME" length="16" not-null="true"/>
       </property>
      
       <property name="sex"/>
      
       <property name="weight"/>
      
       </class>
      
      </hibernate-mapping>
      


      and my hibernate.cfg.xml looks like this:
      <!DOCTYPE hibernate-configuration PUBLIC
       "-//Hibernate/Hibernate Configuration DTD//EN"
       "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
      <hibernate-configuration>
       <session-factory name="foo">
       <property name="show_sql">true</property>
       <mapping resource="org/hibernate/auction/Cat.hbm.xml"/>
       <mapping resource="org/hibernate/auction/Dog.hbm.xml"/>
      
       </session-factory>
      </hibernate-configuration>
      


      Thank you.