Hi all,
I'm a little bit frustrated getting started with Spring and Hibernate.
Hibernate works fine now in a non J2EE environment.
But I still don't know what to define with Hibernate and Spring (ends
up in deployment-descriptor hell).
Has anyone an example with all options (that make sense) when developing
an application with Spring, Hibernate and BEA WebLogic 8.1 ?
The "applicationContext.xml" from the Hibernate skeleton doesn't make
it clear which of the options I should use.
I've defined a connection pool and a data source in WLS and can access it
with
<bean id="exampleDataSource"
class="com.interface21.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>refHibernate</value>
</property>
</bean>
The next option in "applicationContext.xml" is
<bean id="exampleSessionFactory"
class="com.interface21.orm.hibernate.LocalSessionFactoryBean">
<property name="mappingResources">
...
There is a comment above stating
" - This definition can be replaced by a JndiObjectFactoryBean definition
for fetching
- a JNDI-bound SessionFactory, but this only makes sense when using
Hibernate's
- JCA Connector (not recommended for most types of applications)."
Does this mean that I should only use one of these options ?
These things are all explained in 'high level' documents one can understand
if
reading them carefully. But I just want to get started immediately and not
spending
hours of reading this kind of abstract stuff.
IMO it's best to stop the Hibernate/Spring testing and use JDBC (where
examples
are provided) until someone provides a real world example with Hibernate
though I think it's like going back
a few years when programming with Delphi.
Sometimes it's bad to have too many options. Think of a store where you can
buy hundreds
of different products of the same kind. It will take you forever to come to
a decision.
Trying with JDBC now ...
Regards
Lars
|