Ciao Davide, mi dispiace che hai dovuto aspettare la mia risposta, ma ecco, ci siamo! :-) Please forgive me my Italian, I use it only on vacation.
Allora, let's go for it. See my answers below. Cheers... Matthias > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf > Of [EMAIL PROTECTED] > Sent: Monday, December 29, 2003 9:33 AM > To: andromda-user > Subject: [normal] [Andromda-user] AndroMDA+Hibernate: PK and > associations > > > 1. Are PK different from String supported? Can I generate > integer or long PK? Shouldn't be they more performing than > String PK w/ almost all database engines? Yes, you can simply change the type of your primary key attributes in your UML model to "long", then re-generate your classes and see where compilation errors occur. Then, you modify the Hibernate templates (andromda-hibernate/**/*.vsl) so that the generated code compiles and runs. > 2. Can I get androMDA aware of the fact that I'd like to use > native PK generators? Yes. If you want to use them for all classes, simply modify the templates so that they generate the correct XDoclet tags for native PK generators. If you want to use them for some classes only, then you have to invent another tagged value that you can use in the templates to decide whether to generate native PK XDoclet-tags or not. > 3. When modelling associations, Hibernate docs strongly > suggest to set the attributes "inverse" to "true" on the one > side of many-to-one associations in order to > lower (by about 30%) the number of SQL commands to be issued > when establishing/managing the association among two specific > entities. AndroMDA-generated mappings set "inverse" to "false". In the case of many-to-one, this is true. We should optimize that. Could you please submit a feature request and attach a UML model to it that exercises this case? > 4. Another hint coming from Hibernate docs is to set the > attribute "cascade" to "save-update" (at least; other options > could be "all", "all-delete-orphans") instead of "none". This > saves the developer to explicitly save the dependent entity > when setting up a > relation between two entities (e.g. need only to save the > father in a parent-childs relationship). AndroMDA-generated > mappings set "cascade" to "none". Well, cascade="none" was the most trivial thing to do because I did not have the time to think through all possibilities. Example: If A has a one-to-many association to B, this should possibly (!) be generated with cascade="save-update". However, when A has a composition to B (black diamond at the "A" end of the association) this should possibly (!) be generated with cascade="all" or cascade="delete". So, I simply was not sure if cascading is a good idea for all cases and left that decision to the user who can easily modify the templates, according to his/her architectural decisions. What do the other users think about automatic cascades? > 5. Hibernate mapping support a lot of attributes for e.g. the > class or many-to-may elements of the mapping documents (not > null, ...). Is there any way to set them in the UML and then > getting them in the output? I see two possibilities, a quick one and one that's more correct but is not yet available. 1) Invent tagged values (e.g. "@andromda.hibernate.not-null" or something like that) and add some code to your templates that ask for these tagged values and generate not-null tags for XDoclet. This was the dirty and fast way. 2) Wait for AndroMDA comitter Chad Brandon to return from the Holidays and watch him implement the OCL (object constraint language) parser in AndroMDA 3.0 during the next few months. Then, specify what you want as OCL constraints in your UML model and generate XDoclet-tags for Hibernate constraints from there. > After reading the posts in this newsgroup it seems to me that > this could be achieved Yes, I'm quite sure! :-) > I think that the (clever and more experienced than me, > definitely) people who wrote the current template set > designed it with some precise rationale in mind and referring > to some best-practices or experiences. So they _chose_ to set > the inverse attribute to false and so on. So, would you > please explain those rationales and best practices in order > to enable people like me to use this tool to its best? Well, most of it is rationale but some of it is lack of time or understanding on my side. I'm not perfect, you see? :-) > Thanks a lot, and many thanks to all the people who's > providing us such a great instrumentation! > > davide You're welcome to use it! Matthias --- Matthias Bohlen "Consulting that helps project teams to succeed..." http://www.mbohlen.de/ ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click _______________________________________________ Andromda-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/andromda-user
