Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

TopLink Essentials: Using spring session scope on the EntityManagerFactory

455640Dec 10 2007 — edited Apr 14 2008
Hi,

In one of our projects we are trying to utilize the 2nd level cache of TopLink Essentials. The server code is using the Spring (2.0.7) and is deployed to a web container. We are using a Java client and serializes every object between the client and the server.

When a client is started a lot of "static/common" data is read from the server. The first client started will therefor pay some extra performance cost, but additional clients should hopefully be able to perform better due to the cache. Most of the static data is accessed not using JPQL and should therefor not bypass the cache.

If we configure the EntityManagerFactory using default Spring scoping (singleton) it seems like we are not able to utilize the cache. We can see from the log files that each time a client is started a lot of SQL is executed towards the database (Oracle).
  <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="jpaVendorAdapter">
      <bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
        <property name="showSql" value="false" />
        <property name="generateDdl" value="$repository{toplink.generateDdl}" />
        <property name="database" value="$repository{toplink.database}" />
      </bean>
    </property>
    <property name="jpaProperties">
      <props>
        <prop key="toplink.weaving">static</prop>
        <prop key="toplink.logging.level">FINEST</prop>
      </props>
    </property>
  </bean>
When we changes the scoping to spring session the behavior is very different. Then we can see that the first client generates a lot of SQL towards the database and pays a startup cost, while subsequently clients seems to be able to utilize the cache.
  <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" scope="session">
    <aop:scoped-proxy />
    <property name="dataSource" ref="dataSource" />
    <property name="jpaVendorAdapter">
      <bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
        <property name="showSql" value="false" />
        <property name="generateDdl" value="$repository{toplink.generateDdl}" />
        <property name="database" value="$repository{toplink.database}" />
      </bean>
    </property>
    <property name="jpaProperties">
      <props>
        <prop key="toplink.weaving">static</prop>
        <prop key="toplink.logging.level">FINEST</prop>
      </props>
    </property>
  </bean>
Having read the documentation of the spring session scope I'm having a hard time explaining this behavior. As I understand it the EntityManagerFactory will be stored in the HTTP session resulting in a new EntityManagerFactory for each session. I cannot understand how this may result in that we are able to utilize the 2nd level cache? What are the relationship between the EntityManagerFactory and the 2nd level cache?

Is this an accepted way of configuring the EntityManagerFactory or will there be a downside?

I hope someone are able to explain this behavior for me:-)

Best regards,
Rune

Comments

Venkat Krishna
Hi,


You can install rcu on linux.....



You can follow the below link.

http://obieedeveloper.blogspot.com/2012/10/how-to-install-obiee-111116-on-linux.html


Thanks
Venkat
http://obieedeveloper.blogspot.com/

Edited by: Venkat Krishna on May 16, 2013 11:46 AM
Ysaki
Hi Venkat and thanks for the reply

which is more reliable and more preferable ? to have the DB, RCU and OBIEE all on linux or to have the RCU and OBIEE on windows ?

Also when should i install the JDK and Weblogic ?

Thanks
Venkat Krishna
Hi,

R u installating it on server (or) laptop ? it depends......


When you say reliable what do you mean? what is your environment...


Thanks
Venkat
Ysaki
thanks for replying

its going to be on server, what i mean in reliable is linux have less issues and more performance than the windows.


my environment is my OS in linux 64 bit and has couple of database R11

thanks
Yogi1729
Hi ,
install all the RCU and OBIEE on the same Linux machine it will good. and you can accesses this in windows machine as u state that Linux is server.


Thanks,
Yogi.

Edited by: Yogi1729 on May 17, 2013 8:35 AM
Ysaki
Dear Yogi

Thanks for your help and and reply

Thanks
1 - 6
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 12 2008
Added on Dec 10 2007
5 comments
4,488 views