2 Replies Latest reply on Feb 9, 2007 1:44 AM by baz

    HibernateEntityHome vs EntityHome

    baz

      Hello,
      Are there any difference between these two?
      For example:
      I have generated, with seam-gen, a short app containing one Entityclass called person..
      Here is the generated code for the Home object:

      @Name("personHome")
      public class PersonHome extends EntityHome<Person>{
       @RequestParameter
       Long personId;
      
       @Override
       public Object getId() {
       if (personId==null) {
       return super.getId();
       } else {
       return personId;
       }
       }
      
       @Override @Begin
       public void create() {
       super.create();
       }
       }

      Now i wanted to use HibernateEntityHome. The generated files were included in a working app with a hibernatesession. Then i modified the sources to match the new environment. The only intended change to the above file was to change EntityHome to HibernateEntityHome.

      But this results in an exception. (Session is null)
      After an non intended change the class read like so:
      @Name("personHome")
      public class PersonHome extends HibernateEntityHome<Person>{
       @RequestParameter
       Long personId;
      
       @In(create = true) private Session bazDatabase;
       @Override
       public Session getSession(){return bazDatabase; }
      
       @Override
       public Object getId() {
       if (personId==null) {
       return super.getId();
       } else {
       return personId;
       }
       }
      
       @Override @Begin
       public void create() {
       super.create();
       }
       }


      1. Why is the entity manager implicit and the hibernatesession is not?
      2. Why must i specify create="true"? I have set auto-creat="true" on the database
      3. Is it possible to make the session implicit?
      4. how?

      Ciao Carsten