Hello,

I have got a peculiar problem: I am trying to save an attribute to a containermanaged 
entity bean.
It works fine. But if I try to get another reference to exactly the same bean by a 
findByPrimaryKey-method the changes are not saved in the database. 

My code looks as follows:
1                       Sachkonto sk, sk2 = null;
2                               SachkontoBeanPK skpk = new SachkontoBeanPK( 
Long.parseLong( sKey ) );
3                               sk = skHome.findByPrimaryKey( skpk );
4                               System.out.println("before update " + sk.getDef() );
5                   System.out.println("before update " + sk.getId() );
6                               sk.setNr(nr);
7                               sk.setText(text);
8                               sk.setBez(bez);
9                   sk.setGesperrt(gesperrt);
10                  sk.setDef(def);
11                  System.out.println("after update " + sk.getDef() );
12                  System.out.println("after update " + sk.getId() );
13                  sk2 = skHome.findByPrimaryKey( skpk );
14                  System.out.println("after update " + sk2.getDef() );
15                  System.out.println("after update " + sk2.getId() );


the output looks as follows:

before update true
before update 150000063
after update false
after update 150000063
after update true
after update 150000063


The same output comes if I modifies the codse as follows:
1                       Sachkonto sk = null;
2                               SachkontoBeanPK skpk = new SachkontoBeanPK( 
Long.parseLong( sKey ) );
3                               sk = skHome.findByPrimaryKey( skpk );
4                               System.out.println("before update " + sk.getDef() );
5                   System.out.println("before update " + sk.getId() );
6                               sk.setNr(nr);
7                               sk.setText(text);
8                               sk.setBez(bez);
9                   sk.setGesperrt(gesperrt);
10                  sk.setDef(def);
11                  System.out.println("after update " + sk.getDef() );
12                  System.out.println("after update " + sk.getId() );
13                  sk = skHome.findByPrimaryKey( skpk );
14                  System.out.println("after update " + sk.getDef() );
15                  System.out.println("after update " + sk.getId() );

The change are not saved to the database. 

If I delete line 13 - 15 everything works fine. 

Has anyone encountered this problem? 


Answers will be appreciated...
Thanks a lot in advance

Mit freundlichen Gr��en

Torsten Blumreiter

Tel.: 030/399 79 466
Fax: 030/399 79 399
Mobiltel.: 0175/26 50 123
e-mail: [EMAIL PROTECTED]



----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to