-->
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.  [ 2 posts ] 
Author Message
 Post subject: Getting Errors using jndi datasource
PostPosted: Thu Jun 18, 2009 8:05 am 
Newbie

Joined: Fri Aug 15, 2008 11:18 am
Posts: 6
Location: South Carolina
Using JBoss 5.1, Hibernate 3.3.1 core included in application war lib, SqlServer 2005

When I run my application using hibernate datasource things work OK but using jndi datasource I get errors.
Code:
    <hibernate-configuration>

      <session-factory>

      <!-- Database connection settings -->

<!-- this works
         <property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
         <property name="connection.url">url</property>
         <property name="connection.username">username</property>
         <property name="connection.password">password</property>
-->

       <property name="connection.datasource"> <!-- This fails with errors shown below -->
         java:name
       </property>
               
          <!-- SQL dialect -->
           <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>

           <!-- Echo all executed SQL to stdout -->
              <property name="show_sql">false</property>

             <property name="current_session_context_class">thread</property>

=========================================

<datasources>
  <local-tx-datasource>
    <jndi-name>name</jndi-name>
    <connection-url>url;SelectMethod=cursor;DatabaseName=Decode</connection-url>
    <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
    <user-name>username</user-name>
    <password>password</password>
  </local-tx-datasource
====================================================
<hibernate-mapping>
    <class name="ed.sc.gov.cfood.commodity.Commodity" table="Commodity" schema="dbo" catalog="CFood">
        <id name="commId" type="java.lang.Integer">
            <column name="CommID" />
            <generator class="identity" />
        </id>
        <many-to-one name="ltComType" class="ed.sc.gov.cfood.lookup.LtComType" fetch="join">
            <column name="ComType" length="1" not-null="true" />
        </many-to-one>
        <many-to-one name="ltComYear" class="ed.sc.gov.cfood.lookup.LtComYear" fetch="join">
            <column name="ComYear" length="1" not-null="true" />
        </many-to-one>
        <many-to-one name="ltComStorReq" class="ed.sc.gov.cfood.lookup.LtComStorReq" fetch="join">
            <column name="ComStorageReq" length="2" />
        </many-to-one>
        <property name="comCode" type="java.lang.String">
            <column name="ComCode" length="10" not-null="true" />
        </property>
        <property name="comGroup" type="java.lang.Integer">
            <column name="ComGroup" not-null="true" />
        </property>
        <property name="comName" type="java.lang.String">
            <column name="ComName" length="60" not-null="true" />
        </property>
        <property name="comCaseNetWeight" type="java.lang.Double">
            <column name="ComCaseNetWeight" precision="18" />
        </property>
        <property name="comEstCost" type="java.lang.Double">
            <column name="ComEstCost" precision="18" scale="8" />
        </property>
        <property name="comTruckUnits" type="java.lang.Integer">
            <column name="ComTruckUnits" />
        </property>
        <property name="comPackSize" type="java.lang.String">
            <column name="ComPackSize" length="100" />
        </property>
        <property name="lastUpdate" type="java.util.Date">
            <column name="LastUpdate" length="16" />
        </property>
        <property name="lastUpdateBy" type="java.lang.String">
            <column name="LastUpdateBy" length="10" />
        </property>
        <set name="stateSurveyComms" inverse="true">
            <key>
                <column name="CommID" not-null="true" />
            </key>
            <one-to-many class="ed.sc.gov.cfood.survey.StateSurveyComm" />
        </set>
        <set name="deliveryComms" inverse="true">
            <key>
                <column name="CommID" not-null="true" />
            </key>
            <one-to-many class="ed.sc.gov.cfood.allocation.DeliveryComm" />
        </set>
        <set name="processors" table="ProcessorComm" inverse="true" lazy="false">
            <key>
                <column name="CommID" not-null="true" />
            </key>
            <many-to-many class="ed.sc.gov.cfood.processor.Processor">
               <column name="ProcCode" not-null="true" />
            </many-to-many>
        </set>
        <set name="raSurveyComms" inverse="true">
            <key>
                <column name="CommID" not-null="true" />
            </key>
            <one-to-many class="ed.sc.gov.cfood.survey.RaSurveyComm" />
        </set>
        <set name="allocations" inverse="true">
            <key>
                <column name="CommID" not-null="true" />
            </key>
            <one-to-many class="ed.sc.gov.cfood.allocation.Allocation" />
        </set>
    </class>
</hibernate-mapping>



====================================================
exception
org.hibernate.exception.SQLGrammarException: could not initialize a collection: [ed.sc.gov.cfood.commodity.Commodity.processors#1982]
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
org.hibernate.loader.Loader.loadCollection(Loader.java:2022)
org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:59)
org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:587)
org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1743)
org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:476)
org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:867)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:264)
org.hibernate.loader.Loader.doList(Loader.java:2228)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
org.hibernate.loader.Loader.list(Loader.java:2120)
org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
jbosstest.SampleJdbcServlet.doGet(SampleJdbcServlet.java:100)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'ProcessorComm'.
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown Source)
org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:342)
org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
org.hibernate.loader.Loader.getResultSet(Loader.java:1808)
org.hibernate.loader.Loader.doQuery(Loader.java:697)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
org.hibernate.loader.Loader.loadCollection(Loader.java:2015)
org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:59)
org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:587)
org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1743)
org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:476)
org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:867)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:264)
org.hibernate.loader.Loader.doList(Loader.java:2228)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
org.hibernate.loader.Loader.list(Loader.java:2120)
org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
jbosstest.SampleJdbcServlet.doGet(SampleJdbcServlet.java:100)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


Top
 Profile  
 
 Post subject: Re: Getting Errors using jndi datasource
PostPosted: Thu Jun 18, 2009 9:34 am 
Newbie

Joined: Fri Aug 15, 2008 11:18 am
Posts: 6
Location: South Carolina
By removing this

;SelectMethod=cursor;DatabaseName=Decode

from the datasource things seem to work.

I still think there is a lot I don't understand about this jndi, datasource stuff.


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