• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Database synchronization with Entity Bean

 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,
I am using JBOSS 3.2.3 with CMP.
Scenario :
Client side insert a new record(say, record A) through EJB CMP entity bean. Then, I login to the database table and delete that record A manually.
However, I found that the EJB CMP container doesn't synchronize with the database again. i.e. entity bean of record A is still there, although the record A has been deleted by me manually using database client software.
I know EJB CMP usually call ejbLoad() and ejbStore() to synchronize the database. It seems it doesn't call these method.
Do I need to config. the JBOSS CMP so that it can call these two methods regularly.

Thanks
Benson
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My guess is that JBoss comes out of the box with what may be called "commit option A" (that's my guess). There are three options as to how a container may handle the CMP Entity commit: A, B or C, the vendor is free to choose.

Option A: Bean stays connected to EJBObject and assumed to be in sync.
(no ejbActivate & no ejbLoad)
Option B: Bean stays connected but not in sync.
( no ejbActivate - but ejbLoad will be called)
Option C: Bean is disconnected from EJBObject and goes back to pool.
(ejbActivate & ejbLoad are both called)

You can tune JBoss via .../conf/standardjboss.xml search for <commit-option>

One can experience this by getting an Entity bean then going behind the container's back and changing the DB tables directly (SQL) and then seeing if the Entity reflects the change (I suggest just a column update).

I'm trying to figure out how to do this (tune JBoss), how to figure out which option is current for a given Entity Bean/Deployment, etc.

So if you know - please help me out - thanks

David
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys.

This set up per container configuration in standardjboss.xml. I think different types of beans use different commit options.

One cool thing you can do in your jboss.xml is define a container configuration that is SCOPED TO A SINGLE BEAN!!! I think that's pretty cool.

Check this out. It's mostly from their newly free docs.

<?xml version="1.0"?>
<jboss>
<enterprise-beans>
<session>
<ejb-name>EchoBean</ejb-name>
<configuration-name>The coolest Stateless SessionBean</configuration-name>
...
</session>
</enterprise-beans>


<container-configurations>
<container-configuration extends="Standard Stateless SessionBean">
<container-name>The coolect Stateless SessionBean</container-name>
<commit-option>D</commit-option>
</container-configuration>
</container-configurations>
</jboss>

anyway. picking D deviates from the spec, but it can do good stuff. Generally, B is what I've used, and I think that's what Standard CMP 2.x EntityBean defaults to.

Hope this helps!

--Jeff
 
Jeff Shelley
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
of course....session beans don't have commit options. hahaha. but I was trying to point out that you can "extend" a configuration.
 
David Koontz
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeff - what new _free_ docs are you refering to?

I've been looking for Jboss docs - there are hard to find, can you point me to them.

thanks!
 
David Koontz
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
perhaps I've found the free docs you've refered to:

One must be a registered "MemberPlus" of the JBOSS site: http://www.jboss.com/docs/index to have access to the html docs

They state in Chapter 5 http://docs.jboss.org/admin-devel/Chap5.html#0_51484


If an EJB does not provide a container configuration specification in the deployment unit ejb-jar, the container factory chooses a container configuration from the standardjboss.xml descriptor based on the type of the EJB. So, in reality there is an implicit configuration-name element for every type of EJB, and the mappings from the EJB type to default container configuration name are as follows:

  • container-managed persistence entity version 2.0 = Standard CMP 2.x EntityBean
  • container-managed persistence entity version 1.1 = Standard CMP EntityBean
  • bean-managed persistence entity = Standard BMP EntityBean
  • stateless session = Standard Stateless SessionBean
  • stateful session = Standard Stateful SessionBean
  • message driven = Standard Message Driven Bean



  • So that is the "default" mapping between a bean and the container type defined in .../conf/standardjboss.xml
     
    Jeff Shelley
    Ranch Hand
    Posts: 70
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    That's them. It's the html version of their admin guide that you used to have to buy.

    Have a good one!

    --Jeff
     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic