Hi Diego,

from my own experience: it sounds as if the transaction is not closed correctly.
The call to the sequence is no indicator as this happens independent to the
inserts. The inserts happen the moment, the transation is commited.


In standalone-apps I often have code like:

                    sess = sf.openSession();
                    tx = sess.beginTransaction();
                   ...
                   sess.flush();
                    tx.commit();
                    sess.close();

Perhaps your session bean is not configured correctly in regard to transactions?

hth,

Jan

Am 11.04.2005 um 16:22 schrieb Wouter Zoons:

hello Diego,

I'm using Hibernate (with Spring) at work, we're using three databases (not at the same time though) and they all work fine by just updating the properties you speak of

these databases are PostgresQL, Hypersonic and Oracle9i

unfortunately I have no idea what could be causing the problem you and Fabrice describe

I would expect the SQL insert to be executed once the session is closed or flushed, right after getting the sequence.nextval

perhaps someone else on the list has an idea, I don't think it's related to AndroMDA so you might have more luck on the hibernate forums

hope you find it soon

-- Wouter

[EMAIL PROTECTED] wrote:
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



------------------------------------------------------- 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

Reply via email to