Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » don't get latest data from database
don't get latest data from database [message #1286961] Mon, 07 April 2014 04:30 Go to next message
Eclipse UserFriend
I am developing a standalone spring application. It is based on a oracle database which is used with eclipselink JPA.

When the application reads an object from the database, it is correct. The problem comes, when the database is changed from an other program, e.g. SqlDeveloper, SQL-Plus. My program gets only the data as it was before. It looks like the program only takes the Object from the cache and don't look into the database.

If I stop the application, and start it again, it gets the right data.

I tried a lot of options (calling flush, refresh, clear). But it is as it is. My aplication don't see any changes in the database.

Eclipselink weaving is off. I use the spring weaving (SpringLoadTimeWeaver).

Here is my configuraiton ofEntityManagerFactory and TransactionManager:
<tx:annotation-driven transaction-manager = "transactionManager" proxy-target-class="true"  />
      
<bean id="transactionManager" 
          class="org.springframework.orm.jpa.JpaTransactionManager"
          p:entityManagerFactory-ref="entityManagerFactory"/> 
 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
    <property name="url" value="jdbc:oracle:thin:@localhost:1521:far9" />
    <property name="username" value="xxxxx"/>
    <property name="password" value="xxxxx"/>
   </bean> 


<bean id="entityManagerFactory" 
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        	<property name="persistenceUnitName" value="far"/> 
        	<property name="jpaPropertyMap">
            	<props>
                	<prop key="eclipselink.weaving">false</prop>
            	</props>
        	</property>

        	<property name="loadTimeWeaver">
            	<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver">
            	</bean>
        	</property>
        	
  			<property name="jpaVendorAdapter">  
        		<bean
            		class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">  
            			<property name="showSql" value="false"/>
						<property name="generateDdl" value="false"/>
						<property name="database" value="ORACLE"/>
            	
        		</bean>
     		</property>   
  			<property name="jpaDialect">
            	<bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaDialect" />
    		</property>
    </bean>


Harald
Re: don't get latest data from database [message #1290930 is a reply to message #1286961] Thu, 10 April 2014 11:12 Go to previous message
Eclipse UserFriend
When you say you have tried to refresh and clear and don't see any changes, can you show what you have tried? em.refresh(entity) should force a database query to get the data from the database, so either the query isn't happening or the SqlDeveloper transaction isn't visible to the currently active transaction for some reason. Try turning on EclipseLink logging to get more information on what might be happening, and see what is returned from a native SQL query such as em.createNativeQuery("select * from <yourtable>").getResultList();
Previous Topic:XmlAdapter with xml-path
Next Topic:Issue with orphanRemoval = true and OptimisticLockException
Goto Forum:
  


Current Time: Wed Jul 23 07:18:35 EDT 2025

Powered by FUDForum. Page generated in 0.06091 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top