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)
Thanks in Advance for your Help.