Bugs item #504481, was opened at 2002-01-16 17:58
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=504481&group_id=22866

Category: JBossCMP
Group: v2.4 (stable)
>Status: Closed
>Resolution: Fixed
Priority: 9
Submitted By: Shravan (cskreddy74)
Assigned to: Bill Burke (patriot1burke)
Summary: INSERTING AN ALREADY EXISTING BEAN

Initial Comment:
Hi,

I get this error ehen I am trying to insert the 
record into the database form the bean, basically I 
deleted the record from the database manually and 
tried to insert it from the bean, I read the article 
from the previous postings, but could not figure out 
how it works......
please have a look at the smalll code of the CMP bean 
which is attached as .zip files and help me .....

javax.transaction.TransactionRolledbackException: 
INSERTING AN ALREADY EXISTING BEAN, ID = 1; nested 
exception is:
        java.lang.IllegalStateException: INSERTING AN 
ALREADY EXISTING BEAN, ID = 1



Thanks in advance
Shravan



----------------------------------------------------------------------

>Comment By: Sacha Labourey (slaboure)
Date: 2002-07-30 17:28

Message:
Logged In: YES 
user_id=95900

Fixed in Branch_2_4 i.e. JBoss > 2.4.7

----------------------------------------------------------------------

Comment By: Sacha Labourey (slaboure)
Date: 2002-07-29 20:04

Message:
Logged In: YES 
user_id=95900

A bug does exist (even when using commit option C.)

In commit option C, when you call home.create, 
EntityInstanceInterceptor.invokeHome adds the bean to the 
cache (container.getInstanceCache().insert(ctx);). Correct. 
Then, when reaching 
EntitySynchronizationInterceptor.invokeHome (after the 
getNext().invokeHome(mi) call), the context, through a 
callback wrapper, is registered with the current transaction.
Thus, when InstanceSynchronization.afterCompletion is 
called by the TM, the bean is correctly removed from the 
cache (because we are in commit option C). Correct.

But if you then do a call *without* a transaction (typical for 
read-only calls, I know we should always use transaction), 
such as:
 home.findByPrimaryKey(myId).getData();

EntityInstanceInterceptor will add the bean to the cache but, 
as no transaction is available, no InstanceSynchronization 
can/is be registered with the transaction. Consequently, the 
cache-cleaning code is never ran.

Now, if you delete your bean directly in the DB (through 
SQL), and then try to re-create the bean by using 
home.create, the bean is found in the cache and you receive 
the "INSERTING AN ALREADY EXISTING BEAN" message.

Consequently, the "cache-cleaning" code must be also 
executed in one of these two interceptors directly after the 
invoke/invokeHome calls (and not in a callback object) when 
there is no transaction associated with the call and using 
commit option C.


----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2002-03-13 18:07

Message:
Logged In: NO 

It's correct: deleting manually it shouldn't work.
But it happens to me using the remove() and after a create
() on a BMP entitybean, so all the create/remove is done by 
the EJB. 

I posted my problem at http://main.jboss.org/thread.jsp?
forum=47&thread=10642

Thanks & regards,
Luigi.


----------------------------------------------------------------------

Comment By: Christian Riege (lqd)
Date: 2002-01-17 16:15

Message:
Logged In: YES 
user_id=176671

this is not a bug, CLOSING INVALID. Using commit-option C
does the job.

----------------------------------------------------------------------

Comment By: Bill Burke (patriot1burke)
Date: 2002-01-17 16:04

Message:
Logged In: YES 
user_id=176497

I think using commit option 'C' will work.  Look in 
standardjboss.xml for commit-option  it is 'A' by default.  
Commit option 'C' will passivate the Entity Bean at the end 
of every transaction.

----------------------------------------------------------------------

Comment By: Shravan (cskreddy74)
Date: 2002-01-17 15:38

Message:
Logged In: YES 
user_id=260502

hi patriot1burke, 

I have a scenario wherein my database is accessed from an 
legacy system or from an other no-java application which 
is updating hte database constantly and when data is 
changed in database how do I make to reflect in the jboss 
server automatically... I mean atleast how to reduce teh 
cache time or how to disable the caching etc.....




----------------------------------------------------------------------

Comment By: Bill Burke (patriot1burke)
Date: 2002-01-16 21:49

Message:
Logged In: YES 
user_id=176497

If you create a bean through EJB, then delete it manually 
from the database, then try to create it again you will 
fail in this way because JBoss still has the bean in cache.

I'm closing this bug.  It is not a bug.  You are using it 
incorrectly.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=504481&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to