Hi  Johann,

What I want to do is to have a number of different modules that I assemble in different combinations into different variants of my application.I don't want to have to maintain a separate hibernate.cfg.xml file for each application variant .

I suppose I wanted to generate hibernate.cfg.xml or Spring Hibernate session factory configuration based on that assembly of different modules.. The include/exclude would provide control over which annotated classes went into the hibernate.cfg.xml file where that variant of the application was not persisting some of the annotated classes included in one of the modules.

There is also a risk that some external package I am using has annotations for classes in that package that I am not using. In the worst case, the external package may have annotations that interfer with my JPA/Hibernate annotations or may not be compatible with my database.

When looking at my options, I wanted to go down this variant assembly path but could see a risk if I needed to use some otherwise
useful external packages that was poorly constructed.

David Bernard

Johann Reyes wrote:

Hello Bernard

Yes, I was thinking about that. Probably 2 flags: <scanclasses> <scanjars>

<scanclasses> would scan the target\classes and target\test-classes
directory

<scanjars> would scan the jar dependencies

About the include/exclude capability, I think it would be redundant, since
that's the purpose for hibernate.cfg.xml or persistence.xml

What are your thoughts about this Bernard?

Regards

Johann Reyes


-----Original Message-----
From: David Bernard [mailto:[EMAIL PROTECTED] Sent: Thursday, December 14, 2006 7:05 PM
To: dev@mojo.codehaus.org
Subject: Re: [mojo-dev] Re: [hibernate3-maven-plugin] No configurationfile
in configurationTaskProperties

Hi Johann,

I would again suggest that the scanner code should have "include/exclude" capability and that it also scans "compile"
dependency jar files for annotated classes.

The rational for this is that the default behaviour would be the 99% case where the developer wants all the annotated classes processed but allowing the developer to control which classes are processed. I think this follows the "configuration by convention" philisophy but allows the developer to work around unintended consequences of including dependencies required for compilation that have persistence annotations not required
to build / test the module under development.

David Bernard

Geoffrey De Smet wrote:

Well, when using the EntityManager directly and a persistence.xml file, you can let the classloader find all annotated classes too, without having to mention them. It's actually the default IRCC.

And since it would make my life easier too, not to have to mention all my annotated classes, I 'd vote +1 of course :)

Johann Reyes wrote, On 2006-12-13 6:56 PM:

Hello Geoffrey

Yeah, before I was allowing no to specify hibernate.cfg.xml because I
manually scanned for annotated classes and there was no need for it.
Now this revision I'm trying to follow up what the ant plugin is doing, and
basically annotated classes need hibernate.cfg.xml.
So I guess it's vote time again: do I put back the scanner for annotated
classes back on the plugin or just follow up the standards, and file an
improvement with hibernate-tools to see if this can be added to it?

Btw, if you decide to add hibernate.cfg.xml, you can basically put the
values in hbm2ddl.properties inside hibernate.cfg.xml so you wouldn't need these two files, only one. And thanks for the words, just happy to be able to give something back to
the community.

Regards

Johann Reyes

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Geoffrey De Smet
Sent: Wednesday, December 13, 2006 11:00 AM
To: dev@mojo.codehaus.org
Subject: [mojo-dev] [hibernate3-maven-plugin] No configurationfile in
configurationTaskProperties

It took me a while to get some time to test out the new snapshot,
but I finally had some time :)


I am using annotations for my classes and I don't have a hibernate.cfg.xml (I don't have a persistence.xml file either - I am doing everything in a Spring configuration).
This used to work, but now I get this error:


[INFO] [hibernate3:hbm2ddl {execution: default}]
[INFO] src/main/resources/hibernate.cfg.xml not found within the project. Trying absolute path.
[INFO] No hibernate configuration file loaded.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------ [INFO] No hibernate.cfg.xml configuration provided. Annotated classes/packages is only configurable via hibernate.cfg.xml


Here's my config:

<configurationTaskProperties>
<propertyfile>/src/main/hibernate3/hbm2ddl.properties</propertyfile>

<namingstrategy>org.hibernate.cfg.DefaultComponentSafeNamingStrategy</naming

strategy>
</configurationTaskProperties>


Should I make a
 /src/main/hibernate3/hibernate.cfg.xml
especially for the plugin (like I did with the hbm2ddl.properies)?

Thanks for your continued work and help on this list, Johann.



---------------------------------------------------------------------
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

Reply via email to