Announcement Announcement Module
Collapse
No announcement yet.
JPA problem, entityManagerCreation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by Micke
    Could you please post your application context and persistence xml files.
    No problems.

    persistence.xml
    Code:
    <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
    
       <persistence-unit name="SpringJpaGettingStarted" transaction-type="RESOURCE_LOCAL" />
    
    </persistence>
    toplinkApplicationContext.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           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.xsd">
    
       <bean id="restaurantDao" class="blog.jpa.dao.JpaRestaurantDao">
          <property name="entityManagerFactory" ref="entityManagerFactory" />
       </bean>
    
       <bean id="entityManagerFactory" class="org.springframework.orm.jpa.ContainerEntityManagerFactoryBean">
          <property name="dataSource" ref="dataSource" />
          <property name="jpaVendorAdapter">
             <bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
                <property name="showSql" value="true" />
                <property name="generateDdl" value="true" />
                <property name="databasePlatform" value="oracle.toplink.essentials.platform.database.HSQLPlatform" />
             </bean>
          </property>
          <property name="loadTimeWeaver">
             <bean class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver" />
          </property>
       </bean>
    
       <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
          <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
          <!--<property name="url" value="jdbc:hsqldb:hsql://localhost/" />-->
          <property name="url" value="jdbc:hsqldb:hsql://localhost:1717/springJPA" />
          <property name="username" value="sa" />
          <property name="password" value="" />
       </bean>
    
       <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
          <property name="entityManagerFactory" ref="entityManagerFactory" />
          <property name="dataSource" ref="dataSource" />
       </bean>
    
    </beans>
    HTH, Peter

    Comment


    • #17
      It's interesting how people prefer immutable objects but most people I know use setter based injection.

      Comment

      Working...
      X