Nov 19th, 2004, 02:19 PM
CMP and Spring
I've been trying for a few days to get Hibernate to work with a legacy schema (see http://forum.hibernate.org/viewtopic.php?t=936357 for example). I can't seem to make Hibernate like my schema so I'm beguinning to think that it may not be the right technology to use.
IO'm now looking at other options, one being JDO and the other being EJB. My database schema contains a lot of composite keys which act as primary keys and as foreign keys.
The application that used to manage this model did all the relationship management in the application. We now have data integrity issues and other problems associated with this. I'm in the process of re-implementing part of the application to Java. I'm not allowed to change the database model, so I'm stuck with the composite keys.
I'm trying very hard to make sure that whatever persistence technology I use does the relationship management for me. I tried Hibernate, but my experience so far is that it has a lot of trouble with bad schema designs (like mine).
I took a look around at EJB 2.x and JDO. JDO doesn't seem to support foreign composite keys. It's a vendor-specific feature. It looks like I may be able to this using entity beans. I'd like to avoid coding SQL commands in my code as much as possible and let the container (or something else) do it.
So all of this to ask: how can I use entity beans with Spring? Every time someone asks this question, the standard answer seems to be "Don't use EJB's, use Hibernate!" Well, I tried and I'm not getting anywhere. :-(
Nov 19th, 2004, 10:15 PM
well, I am not trying to answer your how EJB question, but, did you consider using http://www.ibatis.com for your database access layer? iBatis is very flexible and does not requires a highly normalized database model. Also, Spring has excellent support for iBatis including easy configuration, DAO Template and declarative transaction demarcation.
For more information, you may review jpetstore sample from Spring distribution.
Nov 22nd, 2004, 08:20 AM
No, I never thought of using iBatis. Let me see whati can do with it.