Discussion:
[Middlegen-user] How can I set lazy="true" for all tables?
Time Lord
2004-10-27 20:10:56 UTC
Permalink
Hi, I'm using hibernate 2.1.6 and middlegen.
Because I always get too much 'associated' data when getting data for a
table with several many-to-one relationships, I put the lazy="true"
statement in the '-to-one' tables. This is fine.

I want to add this by default to all tables - there are 105+ and our data
model is still changing, so how can I tell middlegen to do this
automatically when regenerating .hbm files? I.e, I don't want to have to add
this manually each time I regenerate them.

(I was told that lazy="true" will now be the default for hibernate 3.0, but
I won't use that until it goes 'gold'...)

TIA
Phil

_________________________________________________________________
Surf the net and talk on the phone with Xtra JetStream @
http://xtra.co.nz/jetstream
Ben Litchfield
2004-10-27 20:45:46 UTC
Permalink
On the hibernate plugin tag you need to add the following attributes

proxy="true" genLazyNotProxy="true"

Ben
Post by Time Lord
Hi, I'm using hibernate 2.1.6 and middlegen.
Because I always get too much 'associated' data when getting data for a
table with several many-to-one relationships, I put the lazy="true"
statement in the '-to-one' tables. This is fine.
I want to add this by default to all tables - there are 105+ and our data
model is still changing, so how can I tell middlegen to do this
automatically when regenerating .hbm files? I.e, I don't want to have to add
this manually each time I regenerate them.
(I was told that lazy="true" will now be the default for hibernate 3.0, but
I won't use that until it goes 'gold'...)
TIA
Phil
_________________________________________________________________
http://xtra.co.nz/jetstream
-------------------------------------------------------
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Time Lord
2004-10-27 22:51:50 UTC
Permalink
Post by Ben Litchfield
On the hibernate plugin tag you need to add the following attributes
proxy="true" genLazyNotProxy="true"
Ben
Thanks Ben, that was exactly what I needed! Works beautifully.

And now I've found the webpage for "Plugin Ant Configuration Options",
that'll be handy...

All I need to do now is turn off the automatic 'singularisation' of table
names... darn irritating. Especially with a table called "UserCheckBoxes"
which is renamed "UserCheckBoxe". Any ideas?

I know that the argument is behind the naming, i.e that a single instance of
an object should have a singular name, but this really is a pain because we
have 105+ tables in our table model and code which already uses it, and
1000's of lines of existing SQL, so modifying table names in the model is
not an option.
Yes we could add something like
<table name="STATUS" singular="status" plural="statuses"/>
... for each table, but our team would just rather not have to use this
feature.

_________________________________________________________________
There’s never been a better time to get Xtra JetStream @
http://xtra.co.nz/jetstream

Loading...