Hi Dirk and Santiago. Thanks for your reply.
I'm not complaining really about BMP, as having anyway to use it for two of my
three EB : on implement a tree structure, the other has n/n relationships...
There is still one basic EB, but having PostgreSQL replying automatically with
an oid after each insert, without having to query immediatly behind, is really
worth the trick IMHO. And basic BMP isn't really difficult.

I've changed my implementation, in order to stay with the spec
concerning beans relationships. I keep primary key and home interface reference
for other beans, rather than a direct remote interface reference. But i'm
still getting strange logs, and moreover most of my beans are broken...

[EMAIL PROTECTED]()
[EMAIL PROTECTED]()
[EMAIL PROTECTED]()
[EMAIL PROTECTED]()
[EMAIL PROTECTED]()
[EMAIL PROTECTED]()
select oid from auteur order by nom
[EMAIL PROTECTED]() <--
[EMAIL PROTECTED]()
[EMAIL PROTECTED]()
select * from auteur where oid=26600
[EMAIL PROTECTED]()
update auteur set prenom='Guillaume',nom='Rousse' where oid=26600
That's OK : my session bean get created, then use a entity bean to perform the
search, find one result, then load and store it as soon. But why is there one
extra entitybean involved (ppf.ejb.AuteurBean@8ecb0c93) ?

[EMAIL PROTECTED]()
[EMAIL PROTECTED]()
[EMAIL PROTECTED]()
select oid from rubrique where parent_oid=0 order by nom
[EMAIL PROTECTED]()
select oid from rubrique where parent_oid=27360 order by nom
[EMAIL PROTECTED]()
select oid from rubrique where parent_oid=27969 order by nom
[EMAIL PROTECTED]()
select oid from rubrique where parent_oid=27361 order by nom
[EMAIL PROTECTED]()
select * from rubrique where oid=27360
[EMAIL PROTECTED]()
update rubrique set nom='informatique',parent_oid=0 where oid=27360
[EMAIL PROTECTED]()
select * from rubrique where oid=27969 
System exc. => Rollback the transaction.
System Exception in business method:java.lang.NullPointerException   
That's no more OK : first recursive lookups rechercheParParent() is building a
primaryKey collection for the container to load the, but when it comes to
loading the second one, it fails between the load() (i've checked arguments are
OK) and the store() method. Is it in my code or in the container ? As i get the
same type of problem with my third beans (NullPointerException between a load
and a store), i'm getting to think this can be a bug in Jonas.

Here are my load() and store() methods (OidToPK and PKToOid are just for
converting null pointer to 0 int values , and vice-versa) :

  public void ejbLoad() throws
EJBException {     if (verbose)
    System.out.println(this+".ejbLoad()");
    Connection conn=null;
    try {
      conn=getConnection();
      PreparedStatement stmt = conn.prepareStatement("select * from rubrique where 
oid=?");
      Integer primaryKey = (Integer)context.getPrimaryKey();
      stmt.setInt(1,primaryKey.intValue());
      if (verbose)
      System.out.println(stmt);
      ResultSet rs = stmt.executeQuery();
      if (rs.next()!=false) {
        oid=primaryKey.intValue();
        nom=rs.getString("nom");
        parentPK=OidToPK(rs.getInt("parent_oid"));
      }
      stmt.close();
      isDirty=false;
    } catch (SQLException e) {
      throw new EJBException("Impossible de charger la rubrique � partir de la base de 
donn�es");

    }  finally {
      try {
        conn.close();
    } catch (SQLException ignore) {}
    }
  }

  public void ejbStore() throws EJBException {
    if (verbose)
    System.out.println(this+".ejbStore()");
    Connection conn=null;
    try {
      conn=getConnection();

      PreparedStatement stmt = conn.prepareStatement("update rubrique set 
nom=?,parent_oid=? where oid=?");
      Integer primaryKey = (Integer)context.getPrimaryKey();
      stmt.setString(1,nom);
      stmt.setInt(2,PKToOid(parentPK));
      stmt.setInt(3,primaryKey.intValue());
      if (verbose)
      System.out.println(stmt);
      stmt.executeUpdate();
      stmt.close();
      isDirty=false;
    } catch (SQLException e) {
      throw new EJBException("Impossible de mettre � jour la rubrique dans la base de 
donn�es");
    } finally {
      try {
        conn.close();
    } catch (SQLException ignore) {}
    }
  }


-- 
Guillaume Rousse
Iremia - Universit� de la R�union

Sleep doesn't exists. Just lack of cafeine.
----
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