Hello Matt After some more research I might be able to provide the scanning of jars for annotated classes, that means I have to include entityManager as a dependency for the plugin. I'll see if I can put together something this afternoon.
About you another question, I believe that yes thereis a way. It is : @Column(nullable=false, length=1) @Type(type="yes_no") As per here: http://www.i-proving.ca/space/Technologies/Hibernate/Hibernate+Annotations Regards Johann Reyes -----Original Message----- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 08, 2006 2:21 AM To: [email protected] Subject: Re: [mojo-dev] hibernate3 plugin - scanning for annotations in JARs I tried David's suggestion of unpacking the model JAR into the current project that has the hibernate3-plugin. <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>dependency-maven-plugin</artifactId> <executions> <!-- Extract the model module for access to the annotated classes --> <execution> <phase>generate-test-resources</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>${pom.groupId}</groupId> <artifactId>appfuse-data-common</artifactId> <version>2.0-SNAPSHOT</version> <type>jar</type> <outputDirectory>target/classes</outputDirectory> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> This worked fine. Then I tried changing my Spring "sessionFactory" configuration to refer to a hibernate.cfg.xml instead of an "annotatedClasses" property. This worked as well. I'm not sure which is the better solution. We liked using the annotatedClasses property because we could extend and add to the list of classes using a BeanFactoryPostProcessor. Any advice on the best way to do this and provide extensibility? Another minor issue I'm having that you might know how to solve. Before annotations, I used "Y" and "N" in my dbunit data to import into a char(1). However, after creating the tables with the hibernate3 plugin, I get an error and I have to change Y to 1 and N to 0. Embedded error: Error typecasting value <Y> to INTEGER My .hbm.xml file had type="yes_no" - is it possible to do something similar with annotations? <property name="enabled" type="yes_no" column="account_enabled"/> Thanks, Matt On 11/7/06, Johann Reyes <[EMAIL PROTECTED]> wrote: > > > > > David, > > > > Yes I agree with you, but for this version of the plugin I won't add > patterns yet since I'm reworking the plugin. > > > > Matt > > > > After some digging around, hibernate by default can find hbm.xml files that > are part of a jar, but no annotated classes. For that you either have to use > > mapping class or mapping package and hibernate would be able to find the > annotated classes. I see that you specify the annotated classes in the the > spring configuration, why not move it to configuration.xml and point spring > to that file? > > > > Either way I'll keep looking for a solution > > > > Regards > > > > Johann Reyes > > > > ________________________________ > > > From: David Bernard > [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 07, 2006 7:04 PM > > To: [email protected] > Subject: Re: [mojo-dev] hibernate3 plugin - scanning for annotations in > JARs > > > > > Johann, > > I am not sure that it is safe to process all dependency jars as there may > be junk left over in dependencies that will cause unexpected consequences. > > Perhaps "include" "exclude" patterns that cover file names both in the > build directory and in the JARs (if includeJars set) would cover this case. > > This would allow a series of packages to be built following a > naming/packaging convention. These packages could be assembled into > applications > in different combinations through dependencies. Fine grain control with > includes and excludes would allow specific classes from a package to be > include > with others in the same package excluded. > > > Matt, > > > My work around is as follows (see below): > > 1. Use a hibernate.cfg.xml to identify the required classes which is > packaged with the "model" package. > 2. In the "service-impl" package pom upack the "model" package with the > dependency plugin and run the hibernate3 plugin against it. > > Issues: > Don't really handle multiple "model" case. Could unpack into target/class > and let the hibernate plugin scan(?). This would > > > Cheers > > David Bernard > > > <plugin> > <groupId>org.codehaus.mojo</groupId> > <artifactId>dependency-maven-plugin</artifactId> > <executions> > <!-- Extract the model-hibernate module for access > to the Hibernate mapping files --> > <execution> > <phase>generate-test-resources</phase> > <goals> > <goal>unpack</goal> > </goals> > <configuration> > <artifactItems> > <artifactItem> > <groupId>com.xxxxx.yyyyyy</groupId> > <artifactId>model-hibernate</artifactId> > <version>1.0-SNAPSHOT</version> > <type>jar</type> > > <outputDirectory>src/test/resources</outputDirectory> > </artifactItem> > </artifactItems> > </configuration> > </execution> > </executions> > </plugin> > > <plugin> > <groupId>org.codehaus.mojo</groupId> > > <artifactId>hibernate3-maven-plugin</artifactId> > <configuration> > <hibernate> > > <propertyFile>../src/test/resources/database.properties</propertyFile> > > <configurationFile>src/test/resources/hibernate.cfg.xml</configurationFile> > </hibernate> > </configuration> > <executions> > <!-- Generate DB schema from annotated classes identified in > hibernate.cfg.xml and > apply schema to database --> > <execution> > <id>Generate and Apply DB Schema</id> > <phase>process-test-resources</phase> > <goals> > <goal>schema-update</goal> > </goals> > <configuration> > <drop>false</drop> > <update>false</update> > </configuration> > </execution> > </executions> > <dependencies> > <!-- required for postgresql --> > <dependency> > <groupId>postgresql</groupId> > <artifactId>postgresql</artifactId> > <version>8.1-404.jdbc3</version> > </dependency> > </dependencies> > </plugin> > > > > David Bernard > > > Matt Raible wrote: > > It looks like it is included: > > [DEBUG] added to hibernate classpath: C:\Documents and > Settings\mraible\.m2\repository\org\appfuse\appfuse-data-common\2.0-SNAPSHOT \appfuse-data-common-2.0-SNAPSHOT.jar > > I've attached the full output from mvn -X - hopefully this mailing > list allows attachments. > > Matt > > On 11/7/06, Johann Reyes <[EMAIL PROTECTED]> wrote: > > > > Hello Matt > > Can you run the plugin with the -X parameter and see if the jar that you > are > looking for is getting include? > > Also if you sent me the output it can help me to debug it better. > > Regards > > Johann Reyes > > -----Original Message----- > From: Matt Raible [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 07, 2006 4:58 PM > To: [email protected] > Subject: Re: [mojo-dev] hibernate3 plugin - scanning for annotations in > JARs > > I still get the same error. Here's my plugin configuration: > > <plugin> > <groupId>org.codehaus.mojo</groupId> > > <artifactId>hibernate3-maven-plugin</artifactId> > <configuration> > <hibernate> > > <propertyFile>target/test-classes/database.properties</propertyFile> > <includeJars>true</includeJars> > </hibernate> > <update>true</update> > </configuration> > <executions> > <execution> > <phase>test-compile</phase> > <goals> > <goal>hbm2ddl</goal> > </goals> > </execution> > </executions> > <dependencies> > <dependency> > <groupId>${jdbc.groupId}</groupId> > <artifactId>${jdbc.artifactId}</artifactId> > <version>${jdbc.version}</version> > </dependency> > </dependencies> > </plugin> > > I tried moving <includeJars>true</includeJars> to just below > </hibernate>, but that didn't work either. > > Matt > > On 11/7/06, Johann Reyes <[EMAIL PROTECTED]> wrote: > > Hello Matt > > > > Well, I've just added support for it. It might be temporary, since the > new > > version of the plugin is different to the one in subversion now. > > > > It's already deployed as a snapshot, let me know how it works. > > > > Regards > > > > Johann Reyes > > > > > > - Configuration: > > > > <configuration> > > <hibernate> > > <includeJars>true</includeJars> > > </hibernate> > > </configuration> > > > > > > -----Original Message----- > > From: Matt Raible [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, November 07, 2006 10:25 AM > > To: [email protected] > > Subject: [mojo-dev] hibernate3 plugin - scanning for annotations in JARs > > > > Currently, it seems the hibernate3 plugin scans the target directory > > of the current project, but not the JARs of any dependencies[1]. In > > AppFuse, we have our model objects in a separate artifacts/JAR so they > > can be used by multiple persistence frameworks. > > > > Is the scanning of JARs a feature you plan to add? > > > > Thanks, > > > > Matt > > > > [1] http://issues.appfuse.org/browse/APF-519 > > > > > --------------------------------------------------------------------- > > To unsubscribe from this list please visit: > > > > http://xircles.codehaus.org/manage_email > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe from this list please visit: > > > > http://xircles.codehaus.org/manage_email > > > > > > > -- > http://raibledesigns.com > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > > > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > > > > > > > > > ________________________________ > > > > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > > -- http://raibledesigns.com --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
