This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JForum and the fly likes Suggestion about making entity classes Serializable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "Suggestion about making entity classes Serializable" Watch "Suggestion about making entity classes Serializable" New topic
Author

Suggestion about making entity classes Serializable

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hello! I'm integrating JForum into our webapp now and ran over the serious (at least for me) issue.

I'm using JForum 2.1.7 on JBoss 4. I'm required to manage JForum entites from a separate webapp, so I start up separate copy of ForumRepository and friends in it. Because I need repositories (of my & JForum's webapps) to be synchronized, I wrote MBeanTreeCacheEngine that uses tree cache deployed as JBoss service. So I faced the fact that entites from different webapps are loaded by different classloaders. To solve it, I serialize entities before putting them in cache.

Then I encountered terrible bugs when some things just dissapear from forum. I debugged this to reason that when you serialize entitiy with non-serializable fields (other entities), serialization engine just silently skips them!

So I suggest to make all classes in net.jforum.entities serializable to make them really cacheable - you do require it for stand-alone (not embedded) cache (there are other ways, like in Hibernate, but they are way more complicated). Note that for now many of them already are serializable, but some are not.
[originally posted on jforum.net by skoptelov]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Slightly offtopic, but I filed one more of the cache-related bugs in JIRA:

http://www.jforum.net/jira/browse/JF-613
[originally posted on jforum.net by skoptelov]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Yes, you're right. In order to send the objects through the network, they need to be serializable.

Please open a Jira issue for that one too.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Suggestion about making entity classes Serializable
 
Similar Threads
Persistence cache
Question about Serialization
Complex integration question - multiple jforums -> caching problem?
Jboss Cache - How To?
Does the persistence layer know when the database has changed?