3 Replies Latest reply on Nov 12, 2012 7:33 AM by simplex-software

    How to use an EntityHome from a standalone java client

    simplex-software

      Greetings,

       

      I've used seam-gen (well the JBossTools equivalent in JBDS) to generate the view and the entities from a databse schema. The generated *Home classes are used in the view to persist data. Now, I would like to use the same layer not only from the view but from every where, including from standalone java clients. I came to the following two approaches:

       

      1. I defined a SLSB in which I'm trying to instantiate *Home classes and to invoke their persist/update/remove methods. But this doesn't work, I get a "No Application Context active" upon the invocation of any *Home method.
      2. I decorated the *Home itself with @Stateful (as @Stateless is not supported) and implemet a remote interface. Here there are 2 strange things happening. The first one is that as soon as there are two or more *Home classes annotated with @Stateful and implementing the same interface, any method invocation of any *Home objecvt raises org.seam.InstatiationException. The second is that, if I annotate only one Home class with Stateful, then I can invoke the persist method which generates the correct SQL insert statements but the data doesn't get commited into the database.

      Could anybody help me please to understand what happens exactly here and how to use *Home objects from outside the view ?

       

      Many thanks in advance,

       

      Nicolasq