Thanks for the tip about UserCollectionType - I will investigate further that route.
baliukas wrote:
It must be better to use "EObjects" for code generator, diagram editors and viewers (tool development). Generated application model doe's not need to depend on eclipse and you can can generate any code from "metamodel"
True, but then I have to maintain multiple code generations for the same model. Unfortunately, the Eclipse guys didn't decide on using POJOs - they used EObjects so I am forced to generate those.
Here is a quick example on why EMF is useful. Consider two objects - a Team and a Coach. The Coach references the team. Say an instance of each object is serialized to team.xmi and coach.xmi respectively.
team.xmi
Code:
<?xml version="1.0" encoding="ASCII"?>
<team:Team xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:team="http://xsd.tns.acme.com/sample/team" id="42" name="San Francisco 49ers">
<players name="Julian Peterson"/>
<players name="Fred Beaseley"/>
<players name="Eric Johnson"/>
</team:Team>
coach.xmi
Code:
<?xml version="1.0" encoding="ASCII"?>
<coach:Coach xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:coach="http://xsd.tns.acme.com/sample/coach" name="Mike Nolan">
<team href="team.xmi#/"/>
</coach:Coach>
Note that the Coach does not reference a property of the team - it uses a relative file path instead. EMF provides the resolution of these references and the EObject to XMI serialization used above (as well as a funky but workable UI for generating model objects).
I'm lazy - I was hoping for better existing integration. I don't think I can "pitch" supporting two sets of generated model objects. Either I will wait for EMF to support POJOs (not likely soon) or write a bunch of Hibernate extensions to support EObject (likely to happen sooner).
Thanks for your help.
-mike