Quote:
Intriguing. It' the same book the ofbiz guys used as basis for their data model, right? Now, considering that you have the book and I don't, can you explain what is the purpose of this Party entity?
Exactly where I got the book and party entity from. I was reviewing ofbiz for a project a year or so back and started looking into their entity model. At the time I didn't really have any good books or articles on how to structure people and organizations - I had run into this issue many times in the past and never really found a very satisfying solution.
According to the book and ofbiz - since they pretty much have a stratight translation from the book to their entities - a
Party can represent a person, organization, a automated process, a receiver or sender, etc. It's really more of a, I think, db kinda normalization issue where tie the entity id to its own separate table vs. embedding it in one with various attributes.
At first I didn't really see much value in this. But, as I started working things out more and introducing more tables like 'electronic address' (email, web addr, etc), 'telecomm' (phone, fax, etc) and a table called 'contact_mechanism' which ties the various parties to their respective modes of contact, it all started coming together. Ofbiz has visio and also a gif of their ER diagrams. If you check this out you'll see how party can be pretty central. Also, check out the contact mechanism table to; their data model is pretty big.
Quote:
IMHO, this is a mistake. Do your session and transaction management in your service layer, not in the DAO:s.
Ok, this is good. I've been thinking about this and when it comes down to it, you're right, the transaction is a business decision and if there are any sql exceptions, then I can wrap them in a top level JTA trans and recover from that. Good.
Quote:
Umm, I don't know what you mean here. Hibernate claims to support a fine grained domain model nicely, i.e. that you can very well have lots of small objects without sucky performance. However, there is no recommendation that you must keep transactions as short as possible (i.e. essentially autocommit).
I guess since I was making my transactions probably too fined grained - i.e., create a person, commit, create a organization, commit, create a user login, commit, etc... So that was prob more my question and your other point answered it.
Quote:
That looks somewhat slow, yes. Personally, I would initially concentrate on the following:
1. Proper transaction management. I.e. don't run every friggin insert in its own transaction, operations that belong together should be done in a single transaction. This will improve safety as well as performance, as the db will always be in a consistent state from the viewpoint of the application. Typically, in a web application, you can do all db operations for a single http request in a single transaction.
I think this is a biggie and where I will focus my attention first.
Quote:
2. Check that the database is correctly indexed. This obviously mostly affects read performance, but if you have too many indexes your write performance will suffer.
Yah, I haven't really given it any indexes yet, so I will keep that in mind.
Quote:
3. Enable batch updates (see Hibernate reference manual).
Yah, I think these are already enabled.
Quote:
4. Not a performance suggestion per se, but if you don't use spring, you owe to yourself to check it out. Spring has quite a lot of nice support code to make life with hibernate easier. Also, using spring your code gravitates toward a "best practices" architecture almost by itself, IMHO.
Ya know, I've read about Spring quite a bit, but unfortunately, I went in pretty deep with Struts, so I think I'm stuck with it. Anyway, thanks for the suggestions, this is exactly the kind of stuff I was looking for. Cheers!