wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes configuring jndi lookup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "configuring jndi lookup" Watch "configuring jndi lookup" New topic
Author

configuring jndi lookup

san krish
Ranch Hand

Joined: Aug 11, 2010
Posts: 41
I want to use JNDi lookup for DataBase. Where should i specify them. Rigtnow i have given the hibernate connections in persistance xml file with user name pwd etc. But i dont want to do this. I want to use JNDI lookup and configure my weblogic for the JNDI. What are the changes I need to make in the application context and persistance xml files. Pleas help?

my persistance .xml file looks like this,

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

<persistence-unit name="jpaPersistance" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.ggg.jp.model.bo.individual</class>

<exclude-unlisted-classes/>

<properties>
<property name="hibernate.archive.autodetection" value="class, hbm"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
<property name="hibernate.connection.password" value="test"/>
<property name="hibernate.connection.url" value="jdbcracle:thin:@localhost:1521:xe"/>
<property name="hibernate.connection.username" value="test"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
</properties>

</persistence-unit>

</persistence>

Application context looks like this,
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<!-- <bean/> definitions here -->

<context:annotation-config/>


<bean id="demoDataServiceImpl" class="com.gg.jp.model.services.impl.DemoDataServiceImpl" />

<bean id="recordGeneratorWebServiceHandler" class="com.gg.jp.webservice.RecordGeneratorWebServiceHandler">
<property name="service" ref="demoDataServiceImpl"/>
</bean>

<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="jpaPersistance"/>
</bean>

<tx:annotation-driven/>

<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager" >
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
</beans>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: configuring jndi lookup
 
Similar Threads
facing not a know entity type problem in spring...plzz help me...
Spring Hibernate (JPA) integration
No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single bean but
org.springframework.beans.factory.BeanCreationException
XML name space error in Spring data JPA hibernate applicationContext.xml