hibernate config file:
<?xml version='1.0'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">
java:/comp/env/jdbc/wg
</property>
<property name="dialect">
org.hibernate.dialect.SybaseDialect
</property>
<property name="current_session_context_class">
thread </property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="use_sql_comments">true</property>
<mapping resource="com/msdw/pbefficiency/servicestracker/WGOpportunity.hbm.xml" />
</session-factory>
</hibernate-configuration>
mapping file:
<?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="Opps.By.CompanyId" callable="true">
<return alias="opp" class="com.msdw.pbefficiency.servicestracker.hibernate.pojo.Opportunity">
<return-property name="opportunityName" column="opportunityName" />
<return-property name="companyId" column="itemId" />
<return-property name="status" column="status" />
</return>
{ ? = call qryOpportunityByCompanyId (:itemId) }
</sql-query>
</hibernate-mapping>
The moment I try looking up the session factory (jndi), I get the following error:
Initial SessionFactory creation failed.javax.naming.NamingException: Errors in named queries: Opps.By.CompanyId The proc contents is just a simple select statement. I have checked the return types, column names, class methods etc. Everything is in order.
I also tried to put the proc call like this:
1) { call qryOpportunityByCompanyId (:itemId) }
2) { call qryOpportunityByCompanyId (?) }
3) { ? = call qryOpportunityByCompanyId (?) }
Any help will be appreciated.