-->
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.  [ 1 post ] 
Author Message
 Post subject: User must supply a jdbc connection exception
PostPosted: Mon Jun 13, 2011 10:29 am 
Newbie

Joined: Tue Feb 12, 2008 9:52 am
Posts: 9
Hi,

I am trying to unit test a DAO.
I am using Hibernate with JPA.

I create the entity manager like this in my Junit code :

Code:
EntityManagerFactory factory = Persistence.createEntityManagerFactory ( "central1" );
       
        em = factory.createEntityManager ( );


This is my persistence.xml :

Code:
<?xml version="1.0"?>

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
    http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
   version="1.0">
<persistence-unit name="central1" transaction-type="RESOURCE_LOCAL">
  <class>com.sample.common.entity.Area</class>
  <class>com.sample.common.entity.SomeArea</class>
<properties>
      <property name="javax.persistence.jdbc.user" value="csmart"/>
         <property name="javax.persistence.jdbc.password" value="csmart"/>
         <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@12.12.112.150:1521:ccon"/> 
   </properties>
   </persistence-unit>
</persistence>


When i execute the Query, I get the following exception:
Code:
>java.lang.UnsupportedOperationException: The user must supply a JDBC connection

   at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:30)
   at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
   at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
   at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
   at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1538)
   at org.hibernate.loader.Loader.doQuery(Loader.java:661)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
   at org.hibernate.loader.Loader.doList(Loader.java:2211)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
   at org.hibernate.loader.Loader.list(Loader.java:2090)
   at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:388)
   at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
   at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
   at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)

I could not get any info from searching on the web. Any help would be appreciated.

Thanks
Venu


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.