-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate, XDoclet and multi-tier design
PostPosted: Mon Dec 01, 2003 2:04 pm 
Newbie

Joined: Mon Dec 01, 2003 1:59 pm
Posts: 5
I am using Hibernate (could be any other O/R tool) to provide data
persistence for a web application. The Hibernate 'domain' classes are
hand-coded to include XDoclet tags for O/R mapping. I have a small number of 'first level' objects (where indepedant PK lookups would be used) and a larger number of second-level objects where access is always via a first-level object.

However, I would like to generate ValueObjects (or DTOs - Data Transfer Objects) from the Hibernate-XDoclet classes without having to turn the Hibernate classes into EJB's - an apparant limitation of the current XDoclet <value-object> sub-task. Can this be done? Does anyone have sample code?

I would like to ensure that the application can be scaled between multiple servers. It would appear that I need to generate SLSB and/or EJBs to do this from the Hibernate first-level classes, and it is these generated classes which would use the original Hibernate-XDoclet classes for bean-managed persistence. I cannot find an XDoclet mechanism to generate the Beans's - all the XDoclet tasks I can find seem to be based on manually creating the EJB first. These EJB's would expose various methods to allow access to the rich data structure implemented by the DAO mechanism. Can this be done? Does anyone have sample code?

Would it be better to convert each Hibernate DAO into BOTH an EJB and a
Hibernate-managed class? This approach seems complicated due to unkown impact of using Hibernate specific collections and that second-level objects should not be exposed as EJB's and all access controlled by the first-level object.

The implementation would then continue to use the Struts XDoclet tags etc to generate more of the web tier from the DAO Hibernate classes.

I am relatively new to XDoclet, and not experienced in creating tasks and
using xdt (though have used Velocity, so the concepts are familiar).

Can anyone make some suggestions?

Thanks,

Peter Millington


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 02, 2003 6:45 am 
Senior
Senior

Joined: Wed Aug 27, 2003 4:08 am
Posts: 178
Location: Wiesbaden, Germany
Why do you need value objects?

Value object were introduced by xdoclet ( first there were data objects ) because remote performance of ejb is really poor,
and EJB ( at least entity ) is really sucky architecture.

With hibernate you do not need value objects - your persistent classes are value objects.

I would recommend:
- POJOs persisted by hibernate
- DAO layer which encapsulates business logic
( can be turned into session bean if you like )

- you can place struts form tags on the very same sources
( though I would recommend to evaluate webwork instead.
Is much better in use, but poor documented )


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 02, 2003 9:05 am 
Newbie

Joined: Mon Dec 01, 2003 1:59 pm
Posts: 5
Why value objects ? ...

Value objects would not contain all fields/properties from the database, such as 'last-modified', child collections, calculated values etc.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 02, 2003 7:56 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 8:07 pm
Posts: 229
Location: Brisbane, Australia
Note that "value object" is often a synonym for "DTO", but "value object" can also mean other things. If you mean "value object" in the same sense as "DTO", then you might want to check out this topic about DTOs in the misc forum.

http://forum.hibernate.org/viewtopic.php?t=925966


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

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.