Dear frnd,
I have never used strut 2 but if your using hibernate then
u r supposed to flush your session to update your database.
Regards
D'Souza
On Fri, Nov 20, 2009 at 5:13 AM, Thomas Sattler wrote:
> 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.
>
>
> The Hibernate section of pom.xml says:
>
>
> org.hibernate
> hibernate
>3.2.1.ga
>
>
>
> org.hibernate
> hibernate-annotations
> 3.2.1.ga
>
>
>
> org.hibernate
> hibernate-entitymanager
> 3.2.1.ga
>
>
>
> As I sit here pulling my hair out, does anyone remember having anything
> like
> this happen after an upgrade to 2.1.8? Or an any other circumstance?
>
> Thanks,
> Tom
>