Hello Guys,

Im having some troubble using AndroMDA's hibernate cartridge, this could also be a problem for spring cartridge since it's usin hibernate to persist objects to a RDBMS.

Ok, im using AndroMDA 3.0-RC1 along with maven. So i generated a new project like this : maven andromdapp:generate
For persistence I selected hibernate.

Well after that I created a new Poseidon project and merged the andromda-profile into it.

After that i've modelled a few entities and session, and exceptions, and value objects.

Then I modified the project properties to reflect the RDBMS setting for my environment, I've tried this with to RDBMS and the results are the same.

1st) I've configured the project to use MaxDB
        dataSource=java:/clubEC
        sql.mappings=SapDB
        hibernate.db.dialect=net.sf.hibernate.dialect.SAPDBDialect

2nd)I've configured the project to use PostgreSQL        
        dataSource=java:/clubECPg
        sql.mappings=SapDB
        hibernate.db.dialect=net.sf.hibernate.dialect.SAPDBDialect
After Making the above configurations went to the project main dir and run maven.

Well everythisn went just OK.

I deployed the app on JBoss. That server have two diferente datasources 1 to connect to MaxDB and the other to use PostgreSQL.

I created a client app and tried to persist some data, here is the SessionBean code (part of it)

    protected boolean handleCrearRubro (net.sf.hibernate.Session session, pwc.ce.vo.RubroVO rubro)
        throws pwc.ce.ex.RubroEX
    {
        boolean ok=false;
        System.out.println("Session: " + session + " " + session.getSessionFactory());
        Rubro rubrin = RubroFactory.create(rubro.getNombre());
        System.out.println("Rubro: " + rubrin.getNombre() + " Id: " + rubrin.getIdRubro());
        try {
            session.save(rubrin);
                ok=true;
        } catch (HibernateException e) {
           e.printStackTrace();
        }
        return ok;
    }

After invoking this method on the client and passing a Value Object (rubro) I can see that the Deployed app calls a sequence on the databases but no insert statement.

Just to try things out I inserted a few records manually on the database and tried to recover the data using the findAll Mathod of the session bean, and it works, I can recover data but can not save it.

Skabeat allready found this problem and wrote an email, but nobody answered to his question. I've pasted his mail bellow.

I've chaged the RDBMS from MaxDB to PostgreSQL because I've readed that MAXDB isn't well supported by hibernate, but I got the same problem with PostgreSQL, any clues?

Do I have to specify some tagged value to make this work???

Thanks in advance!

I hope that I just missed something thats really easy to fix :-)

Kind Regards,

Diego Bendlin

(Sorry for the extension, but Im triying to explain the issue as clear as possible.)

----- Forwarded by Diego Bendlin/PY/ABAS/PwC on 10/04/2005 05:59 p.m. -----
skabeat <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]

25/03/2005 11:17 a.m.

       
        To:        andromda-user <[email protected]>
        cc:        
        Subject:        [Andromda-user] hibernate cartridge problem



Hi,

I'm facing a strange problem with hibernate cartridge + postgresql :
I use the following code in a service method :

...
   {
       UserImpl user = new UserImpl();
       user.setLogin(login);
       user.setPassword(password);
       user.setCreatedDate(new Date());
       user.setLastLoginTime(new Date());
       try {
           session.save(user);
         
       } catch (HibernateException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
           throw new OrganizationException(e);
       }
       return user;
   }

the user object is not saved in the database. In the logs I can see the :
Hibernate: select nextval ('hibernate_sequence')
which means that hibernate is getting the Id well. But I can't see a
"insert into.." and I don't have any insert in my pg database logs, only
the select nextval ('hibernate_sequence').
"find" queries work well (ie "from UserImpl")

Any idea?

Thanks

Fabrice


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Andromda-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/andromda-user



_________________________________________________________________
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

Reply via email to