-->
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.  [ 13 posts ] 
Author Message
 Post subject: org.hibernate.MappingException: Unknown entity:
PostPosted: Fri Apr 01, 2005 10:31 am 
Regular
Regular

Joined: Wed Jan 19, 2005 4:52 pm
Posts: 61
Location: Kansas City, USA
Using Hibernate V3.0 rc1

I am getting this error:
org.hibernate.MappingException:
Unknown entity: com.nationsholding.xOps.common.model.Entity

when I try to run this code:
Code:

public EntityNations getEntityByID(String entityId){
      Session session = XopsHibernateUtil.getSession();
      List result = new ArrayList();
      EntityNations entity = null;
      try{
         entity = (EntityNations)session.get(Entity.class, entityId);
      
      }catch( HibernateException ex ){
         LOG.error(ex);
         throw new XOpsException( ex );
      }finally{
         NationsHibernateUtil.commitTransaction();
      }
return entity;
}


I dont think it is the mapping files because when I go to the hibernate console in Eclipse I am able to connect and get data from this mapping (Entity). Does anyone know what may be wrong. Please let me know if you need to see more code.

Tim


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 01, 2005 10:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
The mapping for Entity is not getting built into the SessionFactory. Look at your log where the SF is getting built


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 01, 2005 10:48 am 
Regular
Regular

Joined: Wed Jan 19, 2005 4:52 pm
Posts: 61
Location: Kansas City, USA
I am looking at the log and it looks like the entity is getting mapped, am I missing something else?


- configuring from XML document
- Mapping resource: com/nationsholding/xOps/common/model/OrderNumber.hbm.xml
- Mapping class: com.nationsholding.xOps.common.model.OrderNumber -> order_number
- Mapping resource: com/nationsholding/xOps/common/model/Entity.hbm.xml
- Mapping class: com.nationsholding.xOps.common.model.Entity -> entity
- Configured SessionFactory: java:hibernate/Nations
- processing extends queue
- processing collection mappings
- processing association property references
- processing foreign key constraints
- Using dialect: org.hibernate.dialect.SQLServerDialect
- Default batch fetch size: 1
- Generate SQL with comments: disabled
- Order SQL updates by primary key: disabled
- Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
- Using ASTQueryTranslatorFactory
- Query language substitutions: {}
- Using Hibernate built-in connection pool (not for production use!)
- Hibernate connection pool size: 20
- autocommit mode: false
- using driver: com.microsoft.jdbc.sqlserver.SQLServerDriver at URL: jdbc:microsoft:sqlserver://*******:1433;DatabaseName=**********
- connection properties: {user=WebUserNLS, password=****}
- Scrollable result sets: enabled
- JDBC3 getGeneratedKeys(): disabled
- Using default transaction strategy (direct JDBC transactions)
- No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
- Automatic flush during beforeCompletion(): disabled
- Automatic session close at end of transaction: disabled
- Cache provider: org.hibernate.cache.EhCacheProvider
- Second-level cache: enabled
- Optimize cache for minimal puts: disabled
- Structured second-level cache entries: enabled
- Query cache: disabled
- Echoing all SQL to stdout
- Statistics: disabled
- Deleted entity synthetic identifier rollback: disabled
- Default entity-mode: pojo
- building session factory
- Factory name: java:hibernate/Nations
- JNDI InitialContext properties:{}
- Bound factory to JNDI name: java:hibernate/Nations
- InitialContext did not implement EventContext
- Checking 0 named queries
- org.hibernate.MappingException: Unknown entity: com.nationsholding.xOps.common.model.Entity
- com.nationsholding.xOps.common.Exceptions.XOpsException: org.hibernate.MappingException: Unknown entity: com.nationsholding.xOps.common.model.Entity


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 01, 2005 11:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Ah, you overrode the entity-name in the mapping.

Either do:
Code:
entity = (EntityNations)session.get("entity", entityId);


Or, remove the entity-name attribute from that mapping


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 01, 2005 11:28 am 
Regular
Regular

Joined: Wed Jan 19, 2005 4:52 pm
Posts: 61
Location: Kansas City, USA
tried the
Code:
entity = (EntityNations)session.get("entity", entityId);



That didnt work still get the org.hibernate.MappingException: Unknown entity: entity error. Here is my mapping xml.


Code:
<class name="Entity" table="entity">
      <id name="entityId" column="entity_id">
           <generator class="assigned"/>
        </id>
        <property name="firstName" column="first_name" type="java.lang.String" />
        <property name="middleName" column="middle_name" type="java.lang.String" />
        <property name="lastName" column="last_name" type="java.lang.String"  not-null="true" />
        <property name="idEntityType" column="id_entity_type" type="java.lang.String"  not-null="true" />
        <property name="systemStatus" column="system_status" type="java.lang.Short"  not-null="true" />
        <property name="datetimeCreated" column="datetime_created" type="java.util.Date"  not-null="true" />
        <property name="datetimeModified" column="datetime_modified" type="java.util.Date"  not-null="true" />
        <property name="entityIdModified" column="entity_id_modified" type="java.lang.String"  not-null="true" />
        <property name="oldId" column="old_id" type="java.lang.Integer"  not-null="true" />
        <property name="entityOwnerId" column="entity_owner_id" type="java.lang.String" />
        <property name="locationId" column="location_id" type="java.lang.String" />
        <property name="delFullName" column="del_full_name" type="java.lang.String" />
        <property name="idAddressTypePrimary" column="id_address_type_primary" type="java.lang.String" />
        <property name="idCommunicationTypePrimary" column="id_communication_type_primary" type="java.lang.String" />
    </class>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 01, 2005 11:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
So is it the <hibernate-mapping> surrounding this <class/> element which defines the java package? i.e.:
Code:
<hibernate-mapping package="com.nationsholding.xOps.common.model">
    <class name="Entity" ...>
    </class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 01, 2005 11:38 am 
Regular
Regular

Joined: Wed Jan 19, 2005 4:52 pm
Posts: 61
Location: Kansas City, USA
Sorry missed that on the paste. Here it is
Code:
<hibernate-mapping package="com.nationsholding.xOps.common.model">

    <class name="Entity" table="entity">
      <id name="entityId" column="entity_id">
           <generator class="assigned"/>
        </id>
        <property name="firstName" column="first_name" type="java.lang.String" />
        <property name="middleName" column="middle_name" type="java.lang.String" />
        <property name="lastName" column="last_name" type="java.lang.String"  not-null="true" />
        <property name="idEntityType" column="id_entity_type" type="java.lang.String"  not-null="true" />
        <property name="systemStatus" column="system_status" type="java.lang.Short"  not-null="true" />
        <property name="datetimeCreated" column="datetime_created" type="java.util.Date"  not-null="true" />
        <property name="datetimeModified" column="datetime_modified" type="java.util.Date"  not-null="true" />
        <property name="entityIdModified" column="entity_id_modified" type="java.lang.String"  not-null="true" />
        <property name="oldId" column="old_id" type="java.lang.Integer"  not-null="true" />
        <property name="entityOwnerId" column="entity_owner_id" type="java.lang.String" />
        <property name="locationId" column="location_id" type="java.lang.String" />
        <property name="delFullName" column="del_full_name" type="java.lang.String" />
        <property name="idAddressTypePrimary" column="id_address_type_primary" type="java.lang.String" />
        <property name="idCommunicationTypePrimary" column="id_communication_type_primary" type="java.lang.String" />
    </class>
   
</hibernate-mapping>


My mapped class and the mapping reside in the same package com.nationsholding.xOps.common.model

Thanks for the help.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 01, 2005 11:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Post the stack trace for that exception, as well as the debug level log snippet for this operation. Also, a debug level log for the session-factory startup.

Are you using multiple session-factories by any chance?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 01, 2005 12:11 pm 
Regular
Regular

Joined: Wed Jan 19, 2005 4:52 pm
Posts: 61
Location: Kansas City, USA
Here is the stack trace:
Code:
org.hibernate.MappingException: Unknown entity: com.nationsholding.xOps.common.model.Entity
   at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:489)
   at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:64)
   at org.hibernate.impl.SessionImpl.get(SessionImpl.java:561)
   at org.hibernate.impl.SessionImpl.get(SessionImpl.java:556)
   at com.nationsholding.xOps.common.domain.EntityDAO.getEntityByID(EntityDAO.java:64)
   at com.nationsholding.xOps.common.facade.ejb.TempestOrderFacadeBean.createOrder(TempestOrderFacadeBean.java:103)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at jrun.ejb.interceptors.InvokerInterceptor.invokeObjectMethod(InvokerInterceptor.java:153)
   at jrun.ejb.interceptors.ContainerManagedTransactionInterceptor.invokeRequired(ContainerManagedTransactionInterceptor.java:304)
   at jrun.ejb.interceptors.ContainerManagedTransactionInterceptor.invokeTransactedMethod(ContainerManagedTransactionInterceptor.java:140)
   at jrun.ejb.interceptors.TransactionInterceptor.invokeObjectMethod(TransactionInterceptor.java:130)
   at jrun.ejb.interceptors.StatelessSessionInstanceInterceptor.invokeObjectMethod(StatelessSessionInstanceInterceptor.java:49)
   at jrun.ejb.interceptors.EJBSecurityInterceptor.invokeObjectMethod(EJBSecurityInterceptor.java:81)
   at jrun.ejb.interceptors.LoggerInterceptor.invokeObjectMethod(LoggerInterceptor.java:72)
   at jrun.ejb.EJBContainer.invokeObjectMethod(EJBContainer.java:193)
   at jrun.ejb.invocation.RemoteInvocationProxyImpl.invoke(RemoteInvocationProxyImpl.java:109)
   at jrunx.rmi.RMIBroker.invokeEJB(RMIBroker.java:235)
   at jrunx.rmi.RMIBroker.invoke(RMIBroker.java:142)
   at jrunx.cluster.ClusterAlgorithm.invokeService(ClusterAlgorithm.java:98)
   at jrunx.cluster.ClusterAlgorithm.invokeService(ClusterAlgorithm.java:80)
   at jrunx.rmi.Invocation.invoke(Invocation.java:304)
   at jrunx.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:177)
   at jrun.ejb.invocation.ClientInvocationHandlerImpl.invoke(ClientInvocationHandlerImpl.java:215)
   at $Proxy2.createOrder(Unknown Source)
   at com.nationsholding.xOps.request.biz.XOpsRequestBD.createOrder(XOpsRequestBD.java:76)
   at com.nationsholding.xOps.request.control.ProcessAction.execute(ProcessAction.java:75)
   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
   at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
   at jrun.servlet.JRunRequestDispatcher.invokeNext(JRunRequestDispatcher.java:449)
   at jrun.servlet.JRunRequestDispatcher.forwardInvoke(JRunRequestDispatcher.java:418)
   at jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:175)
   at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
   at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
   at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
   at jrun.servlet.JRunRequestDispatcher.invokeNext(JRunRequestDispatcher.java:449)
   at jrun.servlet.JRunRequestDispatcher.forwardInvoke(JRunRequestDispatcher.java:418)
   at jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:175)
   at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
   at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
   at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
   at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:249)
   at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
   at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
   at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:457)
   at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)


I am running multiple session factories. I access the other before this one and that runs fine. I make sure I close the session on all my calls.

How do I change the debug log level for the session factory? In a previous post I pasted the debug log that I curently get. Here is the full debug code from start to error.

Code:
4/01 10:06:13 debug EJB container for xOpsEJB.jar#XOpsLoginFacade: invocation of Object method getCustomerByLogin beginning
- Hibernate 3.0rc1
- hibernate.properties not found
- using CGLIB reflection optimizer
- using JDK 1.4 java.sql.Timestamp handling
- configuring from XML document
- Mapping resource: com/nationsholding/xOps/common/model/ApplicationProducts.hbm.xml
- Mapping class: com.nationsholding.xOps.common.model.ApplicationProducts -> APPLICATION_PRODUCTS
- Mapping resource: com/nationsholding/xOps/common/model/CustomerOrder.hbm.xml
- Mapping class: com.nationsholding.xOps.common.model.CustomerOrder -> CUSTOMER_ORDER
- Mapping resource: com/nationsholding/xOps/common/model/EntityType.hbm.xml
- Mapping class: com.nationsholding.xOps.common.model.EntityType -> ENTITY_TYPE
- Mapping resource: com/nationsholding/xOps/common/model/OrderActivty.hbm.xml
- Mapping class: com.nationsholding.xOps.common.model.OrderActivty -> ORDER_ACTIVTY
- Mapping resource: com/nationsholding/xOps/common/model/SubProducts.hbm.xml
- Mapping class: com.nationsholding.xOps.common.model.SubProducts -> SUB_PRODUCTS
- Mapping resource: com/nationsholding/xOps/common/model/XopsCustomer.hbm.xml
- Mapping class: com.nationsholding.xOps.common.model.XOpsCustomer -> XOPS_CUSTOMER
- Configured SessionFactory: java:hibernate/xOps
- processing extends queue
- processing collection mappings
- processing association property references
- processing foreign key constraints
- Using dialect: org.hibernate.dialect.SQLServerDialect
- Default batch fetch size: 1
- Generate SQL with comments: disabled
- Order SQL updates by primary key: disabled
- Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
- Using ASTQueryTranslatorFactory
- Query language substitutions: {}
- Using Hibernate built-in connection pool (not for production use!)
- Hibernate connection pool size: 20
- autocommit mode: false
- using driver: com.microsoft.jdbc.sqlserver.SQLServerDriver at URL: jdbc:microsoft:sqlserver://sqldev:1433;DatabaseName=xOps
- connection properties: {user=WebUserNLS, password=****}
- Scrollable result sets: enabled
- JDBC3 getGeneratedKeys(): disabled
- Using default transaction strategy (direct JDBC transactions)
- No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
- Automatic flush during beforeCompletion(): disabled
- Automatic session close at end of transaction: disabled
- Cache provider: org.hibernate.cache.EhCacheProvider
- Second-level cache: enabled
- Optimize cache for minimal puts: disabled
- Structured second-level cache entries: enabled
- Query cache: disabled
- Echoing all SQL to stdout
- Statistics: disabled
- Deleted entity synthetic identifier rollback: disabled
- Default entity-mode: pojo
- building session factory
- No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/JRun4/servers/xOps/SERVER-INF/temp/xOpsWeb.war1407583564/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
- Factory name: java:hibernate/xOps
- JNDI InitialContext properties:{}
- Creating subcontext: hibernate
- Bound factory to JNDI name: java:hibernate/xOps
- InitialContext did not implement EventContext
- Checking 0 named queries
Hibernate: select this_.CUSTOMER_ID as CUSTOMER1_0_, this_.ORIGINATION_NAME as ORIGINAT2_5_0_, this_.ADDRESS_ONE as ADDRESS3_5_0_, this_.ADDRESS_TWO as ADDRESS4_5_0_, this_.CITY as CITY5_0_, this_.ZIP as ZIP5_0_, this_.ZIP_EXT as ZIP7_5_0_, this_.REQUEST_ACCOUNT_NUMBER as REQUEST8_5_0_, this_.REQUEST_USERNAME as REQUEST9_5_0_, this_.REQUEST_PASSWORD as REQUEST10_5_0_, this_.RESPONSE_USERNAME as RESPONSE11_5_0_, this_.RESPONE_PASSWORD as RESPONE12_5_0_, this_.CERTIFICATE as CERTIFI13_5_0_, this_.NATIONS_FORMAT as NATIONS14_5_0_, this_.REQUEST_XSD as REQUEST15_5_0_, this_.RESPONSE_XSD as RESPONSE16_5_0_, this_.ENTITY_VENDOR_ID as ENTITY17_5_0_, this_.EXECUTER_ENTITY_ID as EXECUTER18_5_0_, this_.EXECUTER_ENTITY_HIERARCHY_ID as EXECUTER19_5_0_, this_.EXECUTER_COMPANY_ID as EXECUTER20_5_0_, this_.PARENT_ORDER_NAME as PARENT21_5_0_, this_.CHILD_ORDER_NAME as CHILD22_5_0_, this_.CUSTOMER_NAME as CUSTOMER23_5_0_ from XOPS_CUSTOMER this_ where this_.REQUEST_USERNAME like ?
- SQL Warning: 0, SQLState:
- [Microsoft][SQLServer 2000 Driver for JDBC]Database changed to xOps
- SQL Warning: 0, SQLState:
- [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed database context to 'xOps'.
- SQL Warning: 0, SQLState:
- [Microsoft][SQLServer 2000 Driver for JDBC]Language changed to us_english
- SQL Warning: 0, SQLState:
- [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed language setting to us_english.
04/01 10:06:20 debug EJB container for xOpsEJB.jar#XOpsLoginFacade: invocation of Object method getCustomerByLogin completed in 7060 milliseconds
IOException upon attempt to marshall 0 argument of type com.nationsholding.xOps.request.model.impl.NationsOrderImpl.
04/01 10:06:21 debug EJB container for xOpsEJB.jar#TempestOrderFacade: invocation of Object method createOrder beginning
- configuring from XML document
- Mapping resource: com/nationsholding/xOps/common/model/OrderNumber.hbm.xml
- Mapping class: com.nationsholding.xOps.common.model.OrderNumber -> order_number
- Mapping resource: com/nationsholding/xOps/common/model/Entity.hbm.xml
- Mapping class: com.nationsholding.xOps.common.model.Entity -> ENTITY
- Configured SessionFactory: java:hibernate/Nations
- processing extends queue
- processing collection mappings
- processing association property references
- processing foreign key constraints
- Using dialect: org.hibernate.dialect.SQLServerDialect
- Default batch fetch size: 1
- Generate SQL with comments: disabled
- Order SQL updates by primary key: disabled
- Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
- Using ASTQueryTranslatorFactory
- Query language substitutions: {}
- Using Hibernate built-in connection pool (not for production use!)
- Hibernate connection pool size: 20
- autocommit mode: false
- using driver: com.microsoft.jdbc.sqlserver.SQLServerDriver at URL: jdbc:microsoft:sqlserver://sqldev:1433;DatabaseName=nations_robin
- connection properties: {user=WebUserNLS, password=****}
- Scrollable result sets: enabled
- JDBC3 getGeneratedKeys(): disabled
- Using default transaction strategy (direct JDBC transactions)
- No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
- Automatic flush during beforeCompletion(): disabled
- Automatic session close at end of transaction: disabled
- Cache provider: org.hibernate.cache.EhCacheProvider
- Second-level cache: enabled
- Optimize cache for minimal puts: disabled
- Structured second-level cache entries: enabled
- Query cache: disabled
- Echoing all SQL to stdout
- Statistics: disabled
- Deleted entity synthetic identifier rollback: disabled
- Default entity-mode: pojo
- building session factory
- Factory name: java:hibernate/Nations
- JNDI InitialContext properties:{}
- Bound factory to JNDI name: java:hibernate/Nations
- InitialContext did not implement EventContext
- Checking 0 named queries
- org.hibernate.MappingException: Unknown entity: com.nationsholding.xOps.common.model.Entity


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 01, 2005 12:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
So make certain that you are not making that request on a session from the other session factory.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 01, 2005 12:58 pm 
Regular
Regular

Joined: Wed Jan 19, 2005 4:52 pm
Posts: 61
Location: Kansas City, USA
Ok, I am embarassed. Thanks for the help, I have had two other people here look at that code and nobody noticed that. Its always the easiest things that cause the biggest problems. Thanks again much appriciated, next time I am in TX I owe you lunch.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 01, 2005 1:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Bring on some of the KC BBQ; we'll see how it matches up :)


Top
 Profile  
 
 Post subject: Re: org.hibernate.MappingException: Unknown entity:
PostPosted: Wed Sep 29, 2010 11:28 pm 
Newbie

Joined: Wed Sep 29, 2010 12:28 am
Posts: 3
Hi

I am new to Hibernate. I am using Hibernate 3.3.1 with Jboss 5.

I copied hibernate configuration file and mapping file into ../server/sample/conf directory. And classes files located at ../server/sample/deploy/sample.war/WEB-INF/classes directory.

I am getting same exception(org.hibernate.MappingException: Unknown entity:) when i calling Hibernate from my application. Please help me to resolve this issue.

I tried to copy the mapping file to class file location, but no help.

Hibernate configuration file

Code:
<?xml version='1.0' encoding='utf-8'?>
<hibernate-configuration>
  <session-factory>
    <property name=“connection.datasource">java:sampleDB</property>
    <property name="connection.autocommit">false</property>
    <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
    <property name="show_sql">false</property>
    <property name="jdbc_use_streais_fbr_binary'>true</property>
    <property name="max_fetch_depth">3</property>
    <property name="cache.use_second_level_cache">False</property>
    <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
    <!-- Mapping files -->
    <mapping resource=“sampleLookupGenericData.hbm.xml"/>
  <session-factory>
</hibernate-configuration>


My hibernate mapping file

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <sql-query name="sampleloopup">
    <return alias="generic" class="com.test.sample.portal.data.SampleLookupGenericData“></return>
        SELECT PROJ_NAME as generic.lookUpDescriptionkesult test_Sample_PROJECT
        where PROJ_ID = ?
  </sql-query>
</hibernate-mapping>



Log details

Code:
[ReguestListenerlnterface] registered Tistener interface
[RequestListenerInter ace name=INewBrowserwindoNListener, method=public abstract
apache.wicket.markup.html.INewBrowserwindowListener.onNewBrowserwindow()]
[STDOUT] **** Input value was *******sample
[STDOUT] Query Name has to execute ~->sampleloopup
[Environment] Hibernate 3.3.1.GA
[Environment] hibernate.properties not found
[Environment] Bytecode provider name : javassist
[Environment] using JDK 1.4 ;ava.sql.Timestamp handling
[Confiuration] configuring from resource:hibernate-sampledb.cfg.xml
INFO [Configuration] Configuration resource: hibernate-sampledb.cfg.xml
[Confi uration] Reading mappings from resource : SampleLookupGenericData.hgm.xml
[configuration] Configured SessionFactory: null
[NamingHelper] JNDI InitialContext properties:{}
[batasourceconnectionProviderl Using datasource: java:sampleDB
[SettingsFactory] RDBMS: Microsoft SQL server, version: 9.00.4305
[SettingsFactory] JDBC driver: Microsoft SQL Server JDBC Driver
[Dialect]_Using dialect: org.hibernate.dialect.SQLServerDialect
[TransactionFactoryFactory] Transaction strategy:
org.hibernate.transaction.JTATransactionFactory
[NamingHelper] JNDI InitialContext properties:{}
[TransactionManagerLookupFactory] No TransactionManagerLookup
configured (in JTA environment, use of read-write or transactional second-level
cache is not recommended)
SettingSFactory] Automatic flush during beforeCompletion():disabled
[SettingsFactory] Automatic session close at end of transaction:
disabled
[SettingsFactory] Scrollable resuit sets: enabled
[SettingsFactory] JDBC3 getGeneratedKeys(): enabied
[SettingsFactory] Connection release mode: auto
[SettingsFactory] Maximum outer join fetch depth: 3
[SettingsFactory] Defauit batch fetch size: 1
[SettingsFactory] Generate SQL with comments: disabied
[SettingsFactory] Order SQL updates by primary key: disabied
[SettingsFactory] Order SQL inserts for batching: disabied
[SettingsFactory] Query translator:org.hibernate.hql.ast.ASTQueryTranslatorFactory
[ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
[SettingsFactory] Query language substitutions: {}
[SettingsFactory] JPA-QL strict compiiancez disabied
[SettingsFactory] Second-leve cache: disabied
[SettingsFactory] Query cache: disabied
[SettingsFactory] Cache region factory :
org.hibernate.cache.impl.NoCachingRegionFactory
[SettingsFactory] Optimize cache for minimai puts: disabled
[SettingsFactory] Structured second-level cache entries: disabled
[SettingsFactory] Statistics: disabied
[SettingsFactory] Deleted entity synthetic identifier rollback:disabled
[SettingsFactory] Defauit entity-mode: pojo
[SettingsFactory] Named query checking : enabied
[SessionFactoryImpl] building session factory
[SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
SEVERE [SessionFactoryImpl] Error in named query: sampleloopup
org.hibernate.MappingException: Unknown entity: com.test.sample.portal.data.SampleLookupGenericData
at
org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)



Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.