[JBoss Seam] - Re: How many EntityManagers and SFSBs in a web app?
by SmokingAPipe
Ok, more info:
From: http://docs.jboss.com/seam/latest/reference/en/html/configuration.html section 9.4:
anonymous wrote : Hibernate users developed the open session in view pattern to work around this problem (managing DB connections). This pattern is usually implemented as a transaction which spans the entire request.
That's exactly the PHP solution.
anonymous wrote : There are several problems with this idea, the most serious being that we can't be sure that a transaction has been successful until we commit it, but by the time we commit the transaction, we have already rendered the view.
Which is a serious problem and makes web apps look like crap because it will display "your credit card has been charged" on the top of the page and then a "database transaction failed" message below that, leaving the user thinking, "this site is a joke."
anonymous wrote : Furthermore, this is at best a partial solution to the problem, because we can still meet the dreaded LazyInitializationException if we try to re-use the entity object in the next request.
Which is the most serious problem. PHP solves it by not having any objects which survive beyond a single request, meaning that their apps will never scale without hacks to solve that problem. PHP hacks are either clusters with object caching hacks, or cumbersome database clusters to take out the problem of database scalability. Java wins by having real objects able to stay in memory on the server between requests, but that creates the problem of detached objects, which it sounds like Seam solves with its conversation context and SMPC, which is what I need to get working.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992577#3992577
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992577
19 years, 4 months
[EJB 3.0] - Timers in stateful session bean?
by kstrunk
Hi!
I'm writing a polling html chat for my web project. After login a contact list is display to the user which shows which users are also online. This list is refreshed using Ajax every x seconds. For that the users online state is stored in database using an entity bean.
But how to keep the users online state up-to-date? When a user logs out normally he will be set to offline. But what should I do if the user just closes his browser? Is there a way to get an event if a user has not refreshed his buddy list for a long time (> 2x seconds)? For me this looks like a timer which is reset every time the user refreshed his contact list? But as far as I know timers aren't allowed in stateful session bean, are they? Or does anyone has a better idea how to handle this approch?
I'm using EJB3 with JBoss 4.0.5
Best regards,
Strunker
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992565#3992565
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992565
19 years, 4 months
[JBossCache] - PojoCache 2.0: Bug in CacheApiUtil.exists?
by chasta
Hi,
Please note the following code snippet from CacheApiUtil.java:
| public static boolean exists(CacheSPI cache, Fqn fqn, Object key)
| {
| if(cache.getCacheLoader() != null)
| {
| // Has cache loader
| return (cache.get(fqn, key) != null) ? true : false;
| }
|
| Node node = cache.getRoot().getChild(fqn);
| if(node == null) return false;
| Map map = node.getData();
| return (map.values().contains(key)) ? true: false; // <-- HERE
| }
|
(From latest CVS version of JBossCache 2.0)
Why is the contains() called on the map values and not on the map keys? If I understand the intention correctly, isn't this a bug?
This affects the following snippet:
>From CacheFieldInterceptor.java:
| private boolean isPojoDetached(Invocation invocation)
| {
| boolean detached = false;
|
| // PojoInstance.KEY is "PojoInstance"
| // This will always be false, since we're giving it the key and it looks for
| // the value
| if(!CacheApiUtil.exists(cache_, fqn_, PojoInstance.KEY)) // <-- HERE
| {
| detached = true;
| Object obj = invocation.getTargetObject();
| ...
|
It affects our usage of the cache - the cache throws us spurious exceptions about objects being detached from it (PojoCacheAlreadyDetachedException. We're using local mode with optimistic locking).
Is this a bug? Or perhaps I'm missing something? And if so, any idea why are we getting these spurious exceptions?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992555#3992555
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992555
19 years, 4 months