Discussion:
[Middlegen-user] Middlegen - Hibernate Evaluating - some questions left open
Knud Müller
2005-02-22 14:38:47 UTC
Permalink
Hi all,

I am just evaluating middlegen, especially the hibernate plugin.
Starting yesterday, I got after a workday a complex Domain Model up and
running - thats quite encouraging.
Although I know that sooner or later there will be some deeper look into the
hibernate plugin neccessary, there are some question which appeal so generic
to me, that I really wonder why I did'nt manage to find any documentation
about it.

1. I would like to use hibernate components

- An address has an geo-coordinate (latitude, longitude)
- My database table has the columns latitude, longitude
- My POJO's are generated (hbm2java) with getter and setters for
latitude/longitude

I would like to generate a getter and setter for a component called Point,
which encapsulates latitude and longitude.

How can I manage to use the hibernate-component with automatic code
generation, without writing my own cartridge and without postprocessing?

2. Lists with a sort column

- There is a one to many association using a foreign key between the tables
Member and Address 1:n (A member can have n addresses)
- Address are sorted for a member. Therefore java.util.List should be used
instead of java.util.Set, using a certain integer sort column called
'sort_no'.

How can I manage to get in certain cases java.util.List instead of Sets in a
one to many relationship?

Thank you all in advance,

Alex
Knud Müller
2005-02-23 11:33:56 UTC
Permalink
Hi all,

1. still thinking how this might fit into the architecture.

2. found a working HACK for the second problem. Some changes in the template
results in a working hbm.xml (as this is really a hack for evaluation: do
not use.). As you can see I'am looking for a column in the relational table
named 'SORT_NO'. When it's there List as collection is used. As I am just
writing some Unit-Tests I cannot assure that it works. But the xml looks
fine.
There are some things to do: A column named 'SORT_NO' should not have a
getter and setter as it's just an internal sort index (do not write a
property tag to the xml for those columns).

I would like to add a property to the hibernate middlegen plugin to flexibly
rename those columns.
Are there some additional ideas about using Lists and how to extend the
hibernate tag to solve the problem more generally?

cheers,
Alex
(its my surname)


-----Ursprüngliche Nachricht-----
Von: middlegen-user-***@lists.sourceforge.net
[mailto:middlegen-user-***@lists.sourceforge.net]Im Auftrag von Knud
Müller
Gesendet: Dienstag, 22. Februar 2005 17:38
An: middlegen-***@lists.sourceforge.net
Betreff: [Middlegen-user] Middlegen - Hibernate Evaluating - some
questions left open


Hi all,

I am just evaluating middlegen, especially the hibernate plugin.
Starting yesterday, I got after a workday a complex Domain Model up and
running - thats quite encouraging.
Although I know that sooner or later there will be some deeper look into the
hibernate plugin neccessary, there are some question which appeal so generic
to me, that I really wonder why I did'nt manage to find any documentation
about it.

1. I would like to use hibernate components

- An address has an geo-coordinate (latitude, longitude)
- My database table has the columns latitude, longitude
- My POJO's are generated (hbm2java) with getter and setters for
latitude/longitude

I would like to generate a getter and setter for a component called Point,
which encapsulates latitude and longitude.

How can I manage to use the hibernate-component with automatic code
generation, without writing my own cartridge and without postprocessing?

2. Lists with a sort column

- There is a one to many association using a foreign key between the tables
Member and Address 1:n (A member can have n addresses)
- Address are sorted for a member. Therefore java.util.List should be used
instead of java.util.Set, using a certain integer sort column called
'sort_no'.

How can I manage to get in certain cases java.util.List instead of Sets in a
one to many relationship?

Thank you all in advance,

Alex



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Knud Müller
2005-02-24 07:57:45 UTC
Permalink
Hi All,

as I see very little activity is there a better place for middlegen topics?

Alex

-----Ursprüngliche Nachricht-----
Von: middlegen-user-***@lists.sourceforge.net
[mailto:middlegen-user-***@lists.sourceforge.net]Im Auftrag von Knud
Müller
Gesendet: Mittwoch, 23. Februar 2005 14:32
An: middlegen-***@lists.sourceforge.net
Betreff: AW: [Middlegen-user] Middlegen - Hibernate Evaluating - some
questions left open


Hi all,

1. still thinking how this might fit into the architecture.

2. found a working HACK for the second problem. Some changes in the template
results in a working hbm.xml (as this is really a hack for evaluation: do
not use.). As you can see I'am looking for a column in the relational table
named 'SORT_NO'. When it's there List as collection is used. As I am just
writing some Unit-Tests I cannot assure that it works. But the xml looks
fine.
There are some things to do: A column named 'SORT_NO' should not have a
getter and setter as it's just an internal sort index (do not write a
property tag to the xml for those columns).

I would like to add a property to the hibernate middlegen plugin to flexibly
rename those columns.
Are there some additional ideas about using Lists and how to extend the
hibernate tag to solve the problem more generally?

cheers,
Alex
(its my surname)


-----Ursprüngliche Nachricht-----
Von: middlegen-user-***@lists.sourceforge.net
[mailto:middlegen-user-***@lists.sourceforge.net]Im Auftrag von Knud
Müller
Gesendet: Dienstag, 22. Februar 2005 17:38
An: middlegen-***@lists.sourceforge.net
Betreff: [Middlegen-user] Middlegen - Hibernate Evaluating - some
questions left open


Hi all,

I am just evaluating middlegen, especially the hibernate plugin.
Starting yesterday, I got after a workday a complex Domain Model up and
running - thats quite encouraging.
Although I know that sooner or later there will be some deeper look into the
hibernate plugin neccessary, there are some question which appeal so generic
to me, that I really wonder why I did'nt manage to find any documentation
about it.

1. I would like to use hibernate components

- An address has an geo-coordinate (latitude, longitude)
- My database table has the columns latitude, longitude
- My POJO's are generated (hbm2java) with getter and setters for
latitude/longitude

I would like to generate a getter and setter for a component called Point,
which encapsulates latitude and longitude.

How can I manage to use the hibernate-component with automatic code
generation, without writing my own cartridge and without postprocessing?

2. Lists with a sort column

- There is a one to many association using a foreign key between the tables
Member and Address 1:n (A member can have n addresses)
- Address are sorted for a member. Therefore java.util.List should be used
instead of java.util.Set, using a certain integer sort column called
'sort_no'.

How can I manage to get in certain cases java.util.List instead of Sets in a
one to many relationship?

Thank you all in advance,

Alex



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

Loading...