On 01-12-2008 at 20:03, Chris Herron wrote:
> Tissen,
>
> Its not a good idea to try to solve this problem with synchronization.  
> That will cause other problems if you have multiple users. Try to figure 
> out the root cause of the errors you're encountering.

I second this. Although ActionBeans do not need to be thread-safe (unlike
servlets, Struts actions, etc.), supporting singletons and static methods
must be. And if this cannot be done (see Chris' second remark below), the
code should not be run concurrently.


> By any chance, does the Duplicate Mapping exception occur on the second 
> request when you start your app against an empty database? (no tables, 
> and hibernate is auto-creating the tables). If that is so, you could try 
> ensuring that Hibernate has an opportunity to initialize (create tables) 
> before the first browser request is handled. You can do that with a 
> ServletContextListener.

This is always a good thing: by doing the data initialization at startup, you
prevent the need for needing to lazily initialize the database. This code is
usually tested a lot less, and therefore a tricky source of errors (I used to
semi-regularly make mistakes with that).


Oscar

-- 
   ,-_  Oscar Westra van holthe - Kind      http://www.xs4all.nl/~kindop/
  /() )
 (__ (  I love deadlines. I like the whooshing sound they make as they fly
=/  ()  by.  -- Douglas Adams

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to