Re: problem when generating one-to-many associations wiht xd2 mvn2 plugin
Konstantin Priblouda <kpriblouda-/[email protected]> Sun, 26 Aug 2007 11:14:56 -0700 (PDT)
| Newsgroups | gmane.comp.java.xdoclet-plugins |
|---|---|
| Message-ID | <[email protected]> |
Hi Marco, I seen your mesages and will be able to look in depth tomorrow. Meanwhile, you can look into sources of plugins - there are real samples in testcases which are known to work. Please assure also that you are using fresh snapshot ( build it yourself maybe ) regards, --- Marco Mistroni <[email protected]> wrote: > hi all, > i am using xd2 mvn2 plugin to generate xdoclet > files... but it looks like > it is falling short when i am using associations.. > > here is the class that is failing... > code: > > package com.mm.backend.model; > > import java.util.ArrayList; > import java.util.HashSet; > import java.util.List; > import java.util.Set; > > /** > * @hibernate.class table="ENTRYTYPES" > * @hibernate.discriminator column="discriminator" > * > */ > > > public class AbstractEntryType { > protected String description; > protected Long id; > protected String discriminator; > protected Integer version; > protected List entries = > new ArrayList(); > > > /** > * @hibernate.property > * @return entry type description > */ > public String getDescription() { > // TODO Auto-generated method stub > return description; > } > > /** > * @hibernate.property column="discriminator" > * insert="false" > * update="false" > */ > public String getDiscriminator() { > return discriminator; > } > > /** > * @hibernate.id column="id" > * generator-class="increment" > * unsaved-value="-1" > */ > public Long getId() { > // TODO Auto-generated method stub > return id; > } > > > /** > * @hibernate.version > * unsaved-value="null" > * @return > */ > public Integer getVersion() { > return version; > } > > > public void setDescription(String description) { > // TODO Auto-generated method stub > this.description = description; > } > > > public void setDiscriminator(String > discriminator) { > this.discriminator = discriminator; > } > > public void setId(Long id) { > this.id = id; > } > > public void setVersion(Integer version) { > this.version = version; > } > > /** > * @hibernate.list cascade="save-update" > * @hibernate.collection-one-to-many class=" > com.mm.backend.model.AbstractBudgetEntry" > * @hibernate.collection-key > column="FK_ENTRY_ID" > * @return > */ > public List getEntries() { > return entries; > } > > public void setEntries(List entries) { > this.entries = entries; > } > > > /** common methods ***/ > public boolean equals(Object o) { > if (this == o) return true; > if (!(o instanceof AbstractEntryType)) > return false; > > final AbstractEntryType item = > (AbstractEntryType) o; > > if (! (id == item.getId()) ) return false; > > return true; > } > > public int hashCode() { > int result; > result = 29 * description.hashCode() + > id.intValue() + > version.hashCode(); > return result; > } > > public String toString() { > return "id ('" + getId() + "'), " + > "Desc: '" + getDescription(); > } > > public int compareTo(Object o) { > if (o instanceof AbstractEntryType) { > // Don't compare Date objects! Use the > time in milliseconds! > return String.valueOf(id).compareTo( > String.valueOf( > > ((AbstractEntryType)o).getId())); > } > return 0; > } > > > } > > > and here's the hbm.xml file that gets generated > > <hibernate-mapping> > ¡Ý > <class table="ENTRYTYPES" > name="com.mm.backend.model.AbstractEntryType"> > ¡Ý > <id unsaved-value="-1" name="id" column="id"> > <generator class="increment"/> > </id> > <discriminator column="discriminator"/> > <version unsaved-value="null" name="version"/> > <property name="description"/> > <property name="discriminator" > column="discriminator" update="false" > insert="false"/> > ¡Ý > <list cascade="save-update" name="entries"> > <key/> > </list> > <subclass name="com.mm.backend.model.ExpenseType" > discriminator-value="Expense"/> > <subclass name="com.mm.backend.model.SavingsType" > discriminator-value="Savings"/> > </class> > </hibernate-mapping> > > somehow the key is not getting populated... so in > the output i got this : > > [INFO] XDoclet plugin failed: > Line: 15 Column: 12 > Message: The content of element type "list" is > incomplete, it must match > "(me > ta*,subselect?,cache?,synchronize*,comment?,key,(index|list-index),(element|one- > to-many|many-to-many|composite-element|many-to-any),loader?,sql-insert?,sql-upda > te?,sql-delete?,sql-delete-all?,filter*)". > > [INFO] > ------------------------------------------------------------------------ > [DEBUG] Trace > org.apache.maven.lifecycle.LifecycleExecutionException: > XDoclet plugin > failed: > Line: 15 Column: 12 > Message: The content of element type "list" is > incomplete, it must match > "(me > ta*,subselect?,cache?,synchronize*,comment?,key,(index|list-index),(element|one- > to-many|many-to-many|composite-element|many-to-any),loader?,sql-insert?,sql-upda > te?,sql-delete?,sql-delete-all?,filter*)". > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa > ultLifecycleExecutor.java:564) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle( > DefaultLifecycleExecutor.java:480) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau > ltLifecycleExecutor.java:459) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures( > DefaultLifecycleExecutor.java:311) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen > ts( > DefaultLifecycleExecutor.java:278) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi > fecycleExecutor.java:143) > at > org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334) > at > org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125) > at > org.apache.maven.cli.MavenCli.main(MavenCli.java:272) > at > sun.reflect.NativeMethodAccessorImpl.invoke0(Native > Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. > java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces > sorImpl.java:25) > at > java.lang.reflect.Method.invoke(Method.java:585) > at > org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java > :315) > at > org.codehaus.classworlds.Launcher.launch(Launcher.java:255) > at > org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java > :430) > at > org.codehaus.classworlds.Launcher.main(Launcher.java:375) > Caused by: > org.apache.maven.plugin.MojoExecutionException: > XDoclet plugin > failed : > Line: 15 Column: 12 > Message: The content of element type "list" is > incomplete, it must match > "(me > ta*,subselect?,cache?,synchronize*,comment?,key,(index|list-index),(element|one- > to-many|many-to-many|composite-element|many-to-any),loader?,sql-insert?,sql-upda > te?,sql-delete?,sql-delete-all?,filter*)". > at > org.codehaus.xdoclet.XDocletMojo.execute(XDocletMojo.java:158) > at > org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi > nManager.java:443) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa > ultLifecycleExecutor.java:539) > ... 16 more > Caused by: org.generama.OutputValidationError: > Line: 15 Column: 12 > Message: The content of element type "list" is > incomplete, it must match > "(me > ta*,subselect?,cache?,synchronize*,comment?,key,(index|list-index),(element|one- > to-many|many-to-many|composite-element|many-to-any),loader?,sql-insert?,sql-upda > te?,sql-delete?,sql-delete-all?,filter*)". > at > org.generama.defaults.XMLOutputValidator.validate(XMLOutputValidator. > java:97) > at > org.generama.Plugin.start(Plugin.java:260) > at > org.picocontainer.defaults.DefaultPicoContainer.start(DefaultPicoCont > ainer.java:349) > at > org.nanocontainer.integrationkit.LifecycleContainerBuilder.autoStart( > LifecycleContainerBuilder.java:52) > at > org.nanocontainer.integrationkit.LifecycleContainerBuilder.buildConta > iner( > LifecycleContainerBuilder.java:45) > at > org.codehaus.xdoclet.XDocletMojo.execute(XDocletMojo.java:149) > ... 18 more > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 10 seco > > could anyone help? > > thanks and regards > marco > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? > Stop. > Now Search log events and configuration files using > AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/> _______________________________________________ > xdoclet-plugins-interest mailing list > xdoclet-plugins-interest-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > https://lists.sourceforge.net/lists/listinfo/xdoclet-plugins-interest > ----[ Konstantin Pribluda http://www.pribluda.de ]---------------- JTec quality components: http://www.pribluda.de/projects/ ____________________________________________________________________________________ Pinpoint customers who are looking for what you sell. http://searchmarketing.yahoo.com/ ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/