FindBy problem in EJB1.0
A problem : When a findBy method is used in a container managed , an (implicit)
Update stmt is also executed by the weblogic in the background and it locks
up the database until all the data is fetched by the findby. Bean is Container
Managed and Isolation level is
Transaction_READ_COMMITTED. I am using weblogic 4.5.1 and EJB1.0.
This is a major problem as without any change happening the table gets updated.
Can anyone explain why this happens. I had received a reply that this is a problem
with EJB1.0 and recommendation was to implement isModified method. Can you please
tell in detail how this needs to be implemented. Where this method is to written
and what goes in this method. Also is there anything more specific components
to be created.
I tried to use JDBC instead of using findBy method of entity bean. But still getting
the same results , that is table gets updated when just trying to view. Can you
explain the reason why in JDBC also similar results are observed.
In response to above problem , i received following reply from support
I'm fairly certain the CMP EJB example that ships with WLS 4.5.1 demonstrates
an IsModifiedMethod. Otherwise, it was in the documentation, but I suspect since
4.5.1 is no
longer supported that the docs are no longer on our site. 4.5.1 docs are available
I saw the example of implementation of isModified method in Container Managed
Persistence EJB from the above link mentioned but still i am not clear with its
implementation as to the way the things are implemented for my project is bit
I have following EJB's .
Entity Beans (this will refer to some table in database)
SampleEntity.java (Remote Interface)
SampleEntityBean (Bean Implementation Class)
SampleEntityPK.java (Primary Key Interface Class)
SampleEntityData.java (Interface for creation/updates to table which corresponds
to this entity bean)
SampleEntityDD.txt (Deployment Descriptor)
Session Bean (Used for making call to entity bean for creation of updation of
records in table)
My Client is JSP, from there a servlet gets executed which inturn calls session
bean (SampleSesionBean.java) where updates to Database is done by making calls
to SampleEntityData class.
In my SampleEntityBean.java , I have implemented isModified() and setModified
method as shown in example. I have additional methods called setData(SampleEntityData
data) and getData() implemented in this class which is used for making updates
to database table.
In this method i will say setModified(true) as i want to make the updates to table.
There are few methods in session bean (SampleSessionBean.java) where i am making
direct call to entity bean (sampleEntityBean.java) and updating certain columns
of the table.
Now how do i call setModified() method here. As i have to say sampleEntity.setModfied(true)
at places wherever this being is getting modified. But if i give this , i get
java compilation error as this method is part of bean implementation class (SampleEntityBean.java)
and not remote interface (SampleEntity.java).
Any idea how to implement in this scenario. Please let me know if you have any
such example or idea as to how this has to be implemented.
Please provide me with sample in the above scenarion, how do i implement the isModified()
method as i need to find a solution to this table getting updated without actual
doing any modification to table. This is a very critical problem from my project
point of view.