on 06-29-2005 10:35 AM
Hi,
I have an entity bean with CMP that works fine with the persistance to the database. when I delete some records of the used table of this bean with sql-studio the persistance layer only give me the view to table before the I did the delete. If this is normal on Ok put how can I force my bean to get the actual record of the table. Is there something like a refresh or synchronize of the persistance or entity bean.
Regards Bernd
Hi Bernd,
the default isolation level of the CMP entity beans is Read Committed, i.e. a transaction using an entity bean will load entity's state from the database (which will be the last committed state) and will use this state till its (transaction's) end.
In order to get into the situation you are explaining it seems that you have a long running transaction which loads the entities state, then you delete the record from another transaction and the first one still does not see the effect of the removal.
So in order to see the removed entity a new transaction has to access it, e.g. execute a business method that starts a new transaction.
Regards,
Svetoslav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Svetoslav,
I have a method "public Collection findMethodAll()" in my entiy bean. this mehtod is called from my session bean with:
public AuftragDTO[] GetAuftrag() {
AuftragDTO[] result = new AuftragDTO[0];
try {
Collection col = auftragHome.findMethodAll();
...
// copy col in AuftragDTO[] ...
...
When I understand you right the auftragHome.findMethodALL() has you run in an new transaction. How to do this ? Any sample avaiable ?
Regards Bernd
How can I start a new transaction ?
Hi Bernd,
you should set "Requires New" transaction attribute for the findMethodAll of the entity bean or for the GetAuftrag method of the session bean.
Is the findMethodAll a finder method, i.e. do you have a EJB QL defined for it? If so, then it executes a query to the database, i.e. it should not see the removed entity and should not include it in the collection.
Regards,
Svetoslav
Hi Bernd,
this is difficult to beleive.
1. Do you refresh the jsp page, i.e. execute the select statement after the update via the sql studio?
2. Is there something strange in the finder method - is it a standard finder method with defined EJB QL?
3. Does the EJB QL query really select all entities in the table? Could you give me the EJB QL string?
Regards,
Svetolsav
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.