I use a context.xml in Tomcat (for this development) that specifies my datasource.
I use a separate hibernate configuration properties file for the SchemaExportTask because it can't deal with JNDI, or at least I haven't felt like doing it that way.
A fragment of my applicationContext-hibernate.xml from my spring configuration:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>java:comp/env/jdbc/hageldb</value></property>
</bean>
<!--
- Our Hibernate SessionFactory.
-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="configLocation">
<value>/WEB-INF/hibernate.cfg.xml</value>
</property>
</bean>
I only recently started writing my own XDoclet tasks, I'm using a template to generate interfaces for example. Spring likes things that are done with interfaces. I didn't understand that XJavadoc would find the .hbm.xml files ...
<!-- mapping files -->
<XDtHibernate:forAllPersistentClasses>
<mapping resource="<XDtPackage:packageNameAsPath/>/<XDtClass:className/>.hbm.xml"/>
</XDtHibernate:forAllPersistentClasses>
Brian Topping wrote:
-----Original Message----- From: Konstantin Priblouda [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 23, 2004 5:23 AM To: [EMAIL PROTECTED] Subject: Re: [Xdoclet-user] hibernatecfg
--- Kevin Hagel <[EMAIL PROTECTED]> wrote:
I'm using hibernatecfg, a subtask in CVS headit's not an experiment. but it's mostly not needed. ( this CFG file is trivial, and done per hand faster
version of xdoclet. Seems to work, I particularly like it being able to find
the mapping files without my having to specify each. Mostly for
springframework applicationContext.xml stuff.
I don't see it mentioned on the xdoclet.sourceforge
website though. Is this just an experiment, can I count on it being
there tomorrow?
than generated. )
The goal of the hibernatecfg task was to give a transparent entry point for generating the inline configuration for Hibernate. Since putting it together and running it in production, I can attest that it's needed and important and will be maintained in future XDoclet versions, but note that configuring Hibernate in this manner is only usable in a development environment. If you try to configure hibernate like this in production, you will find your database to be unreachable after a few days of use. This is why there is the option to use the JNDI factory.
So the correct use of this subtask is to use the local factory during development, which automagically adds new classes in the build to the runtime configuration, as you add them, but before deploying to production, flip over to the JNDI factory and use that in production (for instance with the JBoss SAR task). This gives you rapid turnaround on adding or deleting entity classes, no worries about updating the pesky config file when you are thinking about something else, and transparency when you are ready to deploy.
And new upcoming xdoclet-2 plugin does not feature
this
configuration creation
It's not in there yet, if/when anyone needs it, add a task to JIRA with my name on it and I'll get to it sometime soon...
best,
-b
------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
