-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Database Writes Do Not Happen
PostPosted: Fri Nov 20, 2009 11:52 am 
Newbie

Joined: Fri Nov 20, 2009 11:45 am
Posts: 1
Hello all.

I have upgraded a Struts 2.0.11 project to 2.1.8, and I have some strange behavior. The Struts stuff seems to work fine, and the Ajax stuff works fine as well. The Hibernate stuff works as far as reading data is concerned. But when I try to write a record, nothing happens on the database and I get no exception thrown, and I get no errors in the log.

For instance, whenever a user logs in, a LoginHistory object is created, and subsequently written to the login_history table in Postgres. The
application is using the EntityManager to persist a new object. The code is simple; the LoginHistoryService class says:

public void persist(LoginHistory loginHistory)
{ try {
System.out.println("About to insert login_history record") ;
entityManager.persist(loginHistory);
System.out.println("Done inserting login_history record") ;
}
catch (Exception ex)
{
System.out.println(ex.getMessage() ) ;
}
}

I see the two logged messages, and in stepping through with a debugger, the persist statement *seems* to be done, but nothing appears in the database.

Also, when changing a User's account data, nothing winds up in Postgres.
The UserService class says:

public void merge(User user)
{ try {
entityManager.merge(user);
}
catch (Exception ex)
{
System.out.println(ex.getMessage() ) ;
}
}

But the record is never changed.

I had been using 3.2.1.ga versions of hibernate, hibernate_annotations, and hibernate-entitymanager. I thought I might have needed to upgrade, so I went to the latest and greatest (3.3.2 of hibernate, 3.4.0 of annotations and entitymanager), but the behavior (or the lack of it) is the same.

As I sit here pulling my hair out, does anyone remember seeing anything like this?

Thanks,
Tom


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.