Hi,

I don't if this is the good forum to post this issue. If this is not the
case, I will post my topic on spring-hibernate forum

My issue is the following, Hibernate claims that entity Incident does not
exist.

s...@root:osgi> org.hibernate.MappingException: Unknown entity:
org.apache.camel.example.reportincident.model.Incident
        at
org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)
        at
org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1365)
        at
org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:203)
        at
org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:535)
        at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:103)
        at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
        at
org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:534)
        at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:526)
        at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:522)
        at
org.apache.camel.example.reportincident.dao.impl.IncidentDAOImpl.saveIncident(IncidentDAOImpl.java:101)

This error occurs when Hibernate does not find or load the file hbm.xml

Here is my config  :

As you can see I have used mappingLocations instead of mappingResources
because they was an error during the load of the files with mappingResources

        <!--  Hibernate SessionFactory Definition -->
        <bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        
                <!-- Classloading does not work under OSGI -->
                <property name="mappingResources">
                        <list>
                        
<value>META-INF/org/apache/camel/example/reportincident/model/Incident.hbm.xml</value>
                        </list>
                </property>
                 
                <!-- see here 
                    
http://www.carbonfive.com/community/archives/2007/05/using_classpath.html
and 
                     http://jira.springframework.org/browse/SPR-3965 
                     for more info about the classloading issue on OSGI -->
                <property name="mappingLocations">
                        <list>
                        
<value>classpath*:META-INF/org/apache/camel/example/reportincident/model/Incident.hbm.xml</value>
                        </list>
                </property>
                

Any idea ?

Regards

-----
Charles Moulliard
SOA Architect

My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: 
http://www.nabble.com/Issue-with-Hibernate-and-hbm.xml-files-%28SMX4%29-tp22623666p22623666.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to