I found the solution myself.

It was silly, but it seems to me as it could be a typical newbie error.

I have set the wrong transaction attribute. After setting it to
"Required"
everything was fine.

Guido

-----Ursprüngliche Nachricht-----
Von: Guido Leister 
Gesendet: Freitag, 23. Februar 2001 16:23
An: JBoss-User
Betreff: [jBoss-User] CMP


Hi,

i just deployed my first EntityBean. It should use CMP with the
Hypersonic database.

I could create a bean, do some stuff with it ... all works fine.
But i could not get it back, by using "findByPrimaryKey(String)".


This is part of a simple test program:

...
                final String nr="ABC67";
...
                // Create an Interest object from the Home interface
                EBKonto konto = home.create(nr);
                System.out.println("Konto created!");


                // call the calculateCompoundInterest() method to do the
calculation
                System.out.println (konto.getKontonr ());
              konto.buche(new Geld(10.0,"DEM"),"Test10");
            konto.buche(new Geld(20.0,"DEM"),"Test20");
                System.out.println (konto.getSaldo().getBetrag());

            konto = null;
              konto = home.findByPrimaryKey(nr);
                System.out.println("Konto found!");
                System.out.println (konto.getSaldo().getBetrag());

...

Output is:
crun:
     [java] Got context
     [java] Got reference
     [java] Konto created!
     [java] ABC67
     [java] 30.0
     [java] javax.ejb.ObjectNotFoundException: Object with primary key
ABC67 not
 found in storage

And finally a part of the server log:

[JAWS] Create, id is ABC67
[JAWS] Exists command executing: SELECT COUNT(*) FROM EBKontoBean WHERE
kontonr=?
[JAWS] Set parameter: idx=1, jdbcType=VARCHAR, value=ABC67
[JAWS] Create command executing: INSERT INTO EBKontoBean (konto,kontonr)
VALUES (?,?)
[JAWS] Set parameter: idx=1, jdbcType=JAVA_OBJECT,
value=de.oose.funcar.main.konto.KontoImpl@622f2b
[JAWS] Set parameter: idx=2, jdbcType=VARCHAR, value=ABC67
[JAWS] Rows affected = 1
[JAWS] Exists command executing: SELECT COUNT(*) FROM EBKontoBean WHERE
kontonr=?
[JAWS] Set parameter: idx=1, jdbcType=VARCHAR, value=ABC67

So, what is going wrong?

Thanks, 

Guido


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]

Reply via email to