Re: problems with mvn2, Spring and Hibernate... anyone could help?

2007-07-13 Thread Marco Mistroni

thanx johann!
i'll try it out!

regards
marco

On 7/13/07, Johann Reyes <[EMAIL PROTECTED]> wrote:


Hello Marco

I had a problem like that too, overloaded the class to, but didn't like
the
result of it. At then I came up with the following:

* For each project have a hibernate.cfg.xml file that holds reference to
your hibernate classes.

* in your Sring config file have the following:

  



That would work with your local classpath as well with your jars,
including
test phases

Regards

Johann Reyes

On 7/6/07, Marco Mistroni <[EMAIL PROTECTED]> wrote:
>
> Hi Trevor,
> thanks... that would work
> unfortunately my app is splitted in two jars, one for backend and
another
> for
> webapp.
> everythign works fine at the junit level for the backend, but once code
> runs
> in app server ,  where the webapp jar is calling the backend jar for
> interactign with db.. code fails..
> my best option now is to override LocalSessionFactoryBean.. i found
> a sample ont henet, i am going to try and post results..
>
> thanks and regards
> marco
>
> On 7/6/07, Trevor Torrez <[EMAIL PROTECTED]> wrote:
> >
> > The problem is with the ability of the JVM to enumerate resources in
> > the root of the classpath when these resources are in jars.  The
> > mappingJarLocations property would be used to search through jars that
> > are *not* normally on the classpath, so you shouldn't be using that
> > for WEB-INF/lib jars; in some cases you would cause hibernate to read
> > the mapping files twice, once for the jar on the classpath, and once
> > for the jar in the mappingJarLocations -- they just happen to be the
> > same physical jar.
> >
> > The best fix is to create all the hbm.xml files in a "subpackage" of
> > src/main/resources -- perhaps "com/project/domain"; then use a
> > resource pattern like "classpath*:/com/project/domain/**/*.hbm.xml".
> >
> >
> > On 7/5/07, Marco Mistroni <[EMAIL PROTECTED]> wrote:
> > > Hello Jon
> > >   actually it has nothing to do with maven, as i discovered later..
> > since
> > > scope=compile will be visible in the test
> > > it has to do with Spring classloading actually.. i'll post a
solution
> > here
> > > as soon as i finish to try some code i found on
> > > the web
> > >
> > > with kindest regards
> > >  marco
> > >
> > > On 7/5/07, Jon SlinnHawkins <[EMAIL PROTECTED]> wrote:
> > > >
> > > > I think this may be a problem with Surefire and the way spring
uses
> > > > classloaders :
> > > >
> > > >
> > > >
> >
>
http://jira.codehaus.org/browse/SUREFIRE-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel
> > > >
> > > > If you find a solution please post
> > > >
> > > > Thanks
> > > >
> > > >
> > > > Marco Mistroni wrote:
> > > > > hi all,
> > > > > i know i should post this to maven list but it is about spring
and
> i
> > am
> > > > > sure someone here is using maven for building its environment
> > > > >
> > > > > I have an app composed of 3 project:
> > > > > - domain OBjects  , contains domain objects used by web and
> backend
> > > > project
> > > > > - backend project contains hibernate code
> > > > > - webapp contains webwork code that uses hibernate to access
> > database
> > > > >
> > > > > i have been searching for solutions for not hardcoding hibernate
> > mapping
> > > > > files.. i came across mappingJarLocations where you can specify
> jars
> > > > where
> > > > > hbm.xml file are located.
> > > > > this is fine, however i am building my project using maven2 and
i
> am
> > > > > setting
> > > > > the dependency scope for domainObjects.jar on my backend
project..
> > > > > if i use
> > > > > test
> > > > >
> > > > > test will fail because spring won't be able to find hbm.xml file
> > (jar is
> > > > > not
> > > > > in classpath)
> > > > >
> > > > > if  i use
> > > > > compile
> > > > >
> > > > > jar won't be in test classpath
> > > > > i was wondering if anyone on this forum came across same
> > situation...
> > > > >
> > > > > here's my spring context...
> > > > >
> > > > > 
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >classpath*:domainObjects-1.0-SNAPSHOT.jar
> 
> > > > >
> > > > >
> > > > > 
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > thanks in advancea nd regards
> > > > > marco
> > > > >
> > > >
> > > >
> > > >
> -
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>



Re: problems with mvn2, Spring and Hibernate... anyone could help?

2007-07-13 Thread Johann Reyes

Hello Marco

I had a problem like that too, overloaded the class to, but didn't like the
result of it. At then I came up with the following:

* For each project have a hibernate.cfg.xml file that holds reference to
your hibernate classes.

* in your Sring config file have the following:

 
   
   

That would work with your local classpath as well with your jars, including
test phases

Regards

Johann Reyes

On 7/6/07, Marco Mistroni <[EMAIL PROTECTED]> wrote:


Hi Trevor,
thanks... that would work
unfortunately my app is splitted in two jars, one for backend and another
for
webapp.
everythign works fine at the junit level for the backend, but once code
runs
in app server ,  where the webapp jar is calling the backend jar for
interactign with db.. code fails..
my best option now is to override LocalSessionFactoryBean.. i found
a sample ont henet, i am going to try and post results..

thanks and regards
marco

On 7/6/07, Trevor Torrez <[EMAIL PROTECTED]> wrote:
>
> The problem is with the ability of the JVM to enumerate resources in
> the root of the classpath when these resources are in jars.  The
> mappingJarLocations property would be used to search through jars that
> are *not* normally on the classpath, so you shouldn't be using that
> for WEB-INF/lib jars; in some cases you would cause hibernate to read
> the mapping files twice, once for the jar on the classpath, and once
> for the jar in the mappingJarLocations -- they just happen to be the
> same physical jar.
>
> The best fix is to create all the hbm.xml files in a "subpackage" of
> src/main/resources -- perhaps "com/project/domain"; then use a
> resource pattern like "classpath*:/com/project/domain/**/*.hbm.xml".
>
>
> On 7/5/07, Marco Mistroni <[EMAIL PROTECTED]> wrote:
> > Hello Jon
> >   actually it has nothing to do with maven, as i discovered later..
> since
> > scope=compile will be visible in the test
> > it has to do with Spring classloading actually.. i'll post a solution
> here
> > as soon as i finish to try some code i found on
> > the web
> >
> > with kindest regards
> >  marco
> >
> > On 7/5/07, Jon SlinnHawkins <[EMAIL PROTECTED]> wrote:
> > >
> > > I think this may be a problem with Surefire and the way spring uses
> > > classloaders :
> > >
> > >
> > >
>
http://jira.codehaus.org/browse/SUREFIRE-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel
> > >
> > > If you find a solution please post
> > >
> > > Thanks
> > >
> > >
> > > Marco Mistroni wrote:
> > > > hi all,
> > > > i know i should post this to maven list but it is about spring and
i
> am
> > > > sure someone here is using maven for building its environment
> > > >
> > > > I have an app composed of 3 project:
> > > > - domain OBjects  , contains domain objects used by web and
backend
> > > project
> > > > - backend project contains hibernate code
> > > > - webapp contains webwork code that uses hibernate to access
> database
> > > >
> > > > i have been searching for solutions for not hardcoding hibernate
> mapping
> > > > files.. i came across mappingJarLocations where you can specify
jars
> > > where
> > > > hbm.xml file are located.
> > > > this is fine, however i am building my project using maven2 and i
am
> > > > setting
> > > > the dependency scope for domainObjects.jar on my backend project..
> > > > if i use
> > > > test
> > > >
> > > > test will fail because spring won't be able to find hbm.xml file
> (jar is
> > > > not
> > > > in classpath)
> > > >
> > > > if  i use
> > > > compile
> > > >
> > > > jar won't be in test classpath
> > > > i was wondering if anyone on this forum came across same
> situation...
> > > >
> > > > here's my spring context...
> > > >
> > > > 
> > > >
> > > >
> > > >
> > > >
> > > >classpath*:domainObjects-1.0-SNAPSHOT.jar

> > > >
> > > >
> > > > 
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > thanks in advancea nd regards
> > > > marco
> > > >
> > >
> > >
> > >
-
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



Re: problems with mvn2, Spring and Hibernate... anyone could help?

2007-07-06 Thread Marco Mistroni

Hi Trevor,
thanks... that would work
unfortunately my app is splitted in two jars, one for backend and another
for
webapp.
everythign works fine at the junit level for the backend, but once code runs
in app server ,  where the webapp jar is calling the backend jar for
interactign with db.. code fails..
my best option now is to override LocalSessionFactoryBean.. i found
a sample ont henet, i am going to try and post results..

thanks and regards
marco

On 7/6/07, Trevor Torrez <[EMAIL PROTECTED]> wrote:


The problem is with the ability of the JVM to enumerate resources in
the root of the classpath when these resources are in jars.  The
mappingJarLocations property would be used to search through jars that
are *not* normally on the classpath, so you shouldn't be using that
for WEB-INF/lib jars; in some cases you would cause hibernate to read
the mapping files twice, once for the jar on the classpath, and once
for the jar in the mappingJarLocations -- they just happen to be the
same physical jar.

The best fix is to create all the hbm.xml files in a "subpackage" of
src/main/resources -- perhaps "com/project/domain"; then use a
resource pattern like "classpath*:/com/project/domain/**/*.hbm.xml".


On 7/5/07, Marco Mistroni <[EMAIL PROTECTED]> wrote:
> Hello Jon
>   actually it has nothing to do with maven, as i discovered later..
since
> scope=compile will be visible in the test
> it has to do with Spring classloading actually.. i'll post a solution
here
> as soon as i finish to try some code i found on
> the web
>
> with kindest regards
>  marco
>
> On 7/5/07, Jon SlinnHawkins <[EMAIL PROTECTED]> wrote:
> >
> > I think this may be a problem with Surefire and the way spring uses
> > classloaders :
> >
> >
> >
http://jira.codehaus.org/browse/SUREFIRE-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel
> >
> > If you find a solution please post
> >
> > Thanks
> >
> >
> > Marco Mistroni wrote:
> > > hi all,
> > > i know i should post this to maven list but it is about spring and i
am
> > > sure someone here is using maven for building its environment
> > >
> > > I have an app composed of 3 project:
> > > - domain OBjects  , contains domain objects used by web and backend
> > project
> > > - backend project contains hibernate code
> > > - webapp contains webwork code that uses hibernate to access
database
> > >
> > > i have been searching for solutions for not hardcoding hibernate
mapping
> > > files.. i came across mappingJarLocations where you can specify jars
> > where
> > > hbm.xml file are located.
> > > this is fine, however i am building my project using maven2 and i am
> > > setting
> > > the dependency scope for domainObjects.jar on my backend project..
> > > if i use
> > > test
> > >
> > > test will fail because spring won't be able to find hbm.xml file
(jar is
> > > not
> > > in classpath)
> > >
> > > if  i use
> > > compile
> > >
> > > jar won't be in test classpath
> > > i was wondering if anyone on this forum came across same
situation...
> > >
> > > here's my spring context...
> > >
> > > 
> > >
> > >
> > >
> > >
> > >classpath*:domainObjects-1.0-SNAPSHOT.jar
> > >
> > >
> > > 
> > >
> > >
> > >
> > >
> > >
> > >
> > > thanks in advancea nd regards
> > > marco
> > >
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: problems with mvn2, Spring and Hibernate... anyone could help?

2007-07-05 Thread Trevor Torrez

The problem is with the ability of the JVM to enumerate resources in
the root of the classpath when these resources are in jars.  The
mappingJarLocations property would be used to search through jars that
are *not* normally on the classpath, so you shouldn't be using that
for WEB-INF/lib jars; in some cases you would cause hibernate to read
the mapping files twice, once for the jar on the classpath, and once
for the jar in the mappingJarLocations -- they just happen to be the
same physical jar.

The best fix is to create all the hbm.xml files in a "subpackage" of
src/main/resources -- perhaps "com/project/domain"; then use a
resource pattern like "classpath*:/com/project/domain/**/*.hbm.xml".


On 7/5/07, Marco Mistroni <[EMAIL PROTECTED]> wrote:

Hello Jon
  actually it has nothing to do with maven, as i discovered later.. since
scope=compile will be visible in the test
it has to do with Spring classloading actually.. i'll post a solution here
as soon as i finish to try some code i found on
the web

with kindest regards
 marco

On 7/5/07, Jon SlinnHawkins <[EMAIL PROTECTED]> wrote:
>
> I think this may be a problem with Surefire and the way spring uses
> classloaders :
>
>
> 
http://jira.codehaus.org/browse/SUREFIRE-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel
>
> If you find a solution please post
>
> Thanks
>
>
> Marco Mistroni wrote:
> > hi all,
> > i know i should post this to maven list but it is about spring and i am
> > sure someone here is using maven for building its environment
> >
> > I have an app composed of 3 project:
> > - domain OBjects  , contains domain objects used by web and backend
> project
> > - backend project contains hibernate code
> > - webapp contains webwork code that uses hibernate to access database
> >
> > i have been searching for solutions for not hardcoding hibernate mapping
> > files.. i came across mappingJarLocations where you can specify jars
> where
> > hbm.xml file are located.
> > this is fine, however i am building my project using maven2 and i am
> > setting
> > the dependency scope for domainObjects.jar on my backend project..
> > if i use
> > test
> >
> > test will fail because spring won't be able to find hbm.xml file (jar is
> > not
> > in classpath)
> >
> > if  i use
> > compile
> >
> > jar won't be in test classpath
> > i was wondering if anyone on this forum came across same situation...
> >
> > here's my spring context...
> >
> > 
> >
> >
> >
> >
> >classpath*:domainObjects-1.0-SNAPSHOT.jar
> >
> >
> > 
> >
> >
> >
> >
> >
> >
> > thanks in advancea nd regards
> > marco
> >
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: problems with mvn2, Spring and Hibernate... anyone could help?

2007-07-05 Thread Marco Mistroni

Hello Jon
 actually it has nothing to do with maven, as i discovered later.. since
scope=compile will be visible in the test
it has to do with Spring classloading actually.. i'll post a solution here
as soon as i finish to try some code i found on
the web

with kindest regards
marco

On 7/5/07, Jon SlinnHawkins <[EMAIL PROTECTED]> wrote:


I think this may be a problem with Surefire and the way spring uses
classloaders :


http://jira.codehaus.org/browse/SUREFIRE-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel

If you find a solution please post

Thanks


Marco Mistroni wrote:
> hi all,
> i know i should post this to maven list but it is about spring and i am
> sure someone here is using maven for building its environment
>
> I have an app composed of 3 project:
> - domain OBjects  , contains domain objects used by web and backend
project
> - backend project contains hibernate code
> - webapp contains webwork code that uses hibernate to access database
>
> i have been searching for solutions for not hardcoding hibernate mapping
> files.. i came across mappingJarLocations where you can specify jars
where
> hbm.xml file are located.
> this is fine, however i am building my project using maven2 and i am
> setting
> the dependency scope for domainObjects.jar on my backend project..
> if i use
> test
>
> test will fail because spring won't be able to find hbm.xml file (jar is
> not
> in classpath)
>
> if  i use
> compile
>
> jar won't be in test classpath
> i was wondering if anyone on this forum came across same situation...
>
> here's my spring context...
>
> 
>
>
>
>
>classpath*:domainObjects-1.0-SNAPSHOT.jar
>
>
> 
>
>
>
>
>
>
> thanks in advancea nd regards
> marco
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: problems with mvn2, Spring and Hibernate... anyone could help?

2007-07-05 Thread Jon SlinnHawkins
I think this may be a problem with Surefire and the way spring uses 
classloaders :


http://jira.codehaus.org/browse/SUREFIRE-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel

If you find a solution please post

Thanks


Marco Mistroni wrote:

hi all,
i know i should post this to maven list but it is about spring and i am
sure someone here is using maven for building its environment

I have an app composed of 3 project:
- domain OBjects  , contains domain objects used by web and backend project
- backend project contains hibernate code
- webapp contains webwork code that uses hibernate to access database

i have been searching for solutions for not hardcoding hibernate mapping
files.. i came across mappingJarLocations where you can specify jars where
hbm.xml file are located.
this is fine, however i am building my project using maven2 and i am 
setting

the dependency scope for domainObjects.jar on my backend project..
if i use
test

test will fail because spring won't be able to find hbm.xml file (jar is 
not

in classpath)

if  i use
compile

jar won't be in test classpath
i was wondering if anyone on this forum came across same situation...

here's my spring context...


   
   
   
   
   classpath*:domainObjects-1.0-SNAPSHOT.jar
   
   

   
   




thanks in advancea nd regards
marco




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



problems with mvn2, Spring and Hibernate... anyone could help?

2007-07-04 Thread Marco Mistroni

hi all,
i know i should post this to maven list but it is about spring and i am
sure someone here is using maven for building its environment

I have an app composed of 3 project:
- domain OBjects  , contains domain objects used by web and backend project
- backend project contains hibernate code
- webapp contains webwork code that uses hibernate to access database

i have been searching for solutions for not hardcoding hibernate mapping
files.. i came across mappingJarLocations where you can specify jars where
hbm.xml file are located.
this is fine, however i am building my project using maven2 and i am setting
the dependency scope for domainObjects.jar on my backend project..
if i use
test

test will fail because spring won't be able to find hbm.xml file (jar is not
in classpath)

if  i use
compile

jar won't be in test classpath
i was wondering if anyone on this forum came across same situation...

here's my spring context...


   
   
   
   
   classpath*:domainObjects-1.0-SNAPSHOT.jar
   
   

   
   




thanks in advancea nd regards
marco