ENC
|
 |
«
Posted
2006-10-17 07:11:55 » |
|
I just came across the Spring Framework like only yesteryday. And found it to be a blast. W00t! Haha...
However I also do understand that Spring can link up with Hibernate in some ways.. the current Framework I linking with my databases.. can someone explain to me how?
Cheers!
|
|
|
|
Mr_Light
|
 |
«
Reply #1 - Posted
2006-10-17 08:29:09 » |
|
It's not linked up as soon as your linking something in spring you go down a path of frustration and pain.
it is placed on top of the framework. the confusing bit that most ppl get lost in that springmvc is counted with the framework it's not(just part of the distribution.), its also placed on top of the framework.
|
It's harder to read code than to write it. - it's even harder to write readable code.
The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
|
|
|
cylab
|
 |
«
Reply #2 - Posted
2006-10-17 10:10:31 » |
|
I use Spring (with Tiles) and Hibernate at work and while it does offer some advantages for big projects, it has a steep learning curve and sometimes complicates simple things.
|
Mathias - I Know What [you] Did Last Summer!
|
|
|
Games published by our own members! Check 'em out!
|
|
noblemaster
|
 |
«
Reply #3 - Posted
2006-10-17 18:52:05 » |
|
@cylab: what's your opinion on Hibernate? I used it because I thought it is really cool the way you can map relational database tables with objects. But then, as you mentioned, there are tons of things that actually seem to make life harder compared to using PreparedStatement.
|
|
|
|
Mr_Light
|
 |
«
Reply #4 - Posted
2006-10-17 21:46:57 » |
|
hibernate is nice profided you use xdoclet(or annotations I suppose) to generate hbm mappings. that and HQL is just great.
|
It's harder to read code than to write it. - it's even harder to write readable code.
The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
|
|
|
ENC
|
 |
«
Reply #5 - Posted
2006-10-18 01:46:44 » |
|
It's not linked up as soon as your linking something in spring you go down a path of frustration and pain.
it is placed on top of the framework. the confusing bit that most ppl get lost in that springmvc is counted with the framework it's not(just part of the distribution.), its also placed on top of the framework.
So I get you right... If I want to link Spring and Hibernate all I have to do is to configure Spring such that the Hibernate Componets will be covered? Cheers!
|
|
|
|
cylab
|
 |
«
Reply #6 - Posted
2006-10-18 05:21:48 » |
|
@kingaschi My opinion changes from day to day even after using hibernate for 2 years now  If everything goes well, hibernate is really great, if you have a bug, you curse the day you started with that mess.  So I don't know if I like it. There is a nice abstraction for relations and such, but then again I constantly shooting myself in the foot with hibernate sessions, lazy loading, custom types etc. :/ @ENC Yes: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| <!-- This is an example for using hibernate with Annotations in spring --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource"> <ref local="dataSource"/> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> </props> </property> <property name="annotatedClasses"> <list> <value>[yourannotatedclass1]</value> <value>[yourannotatedclass2]</value> <value>[yourannotatedclassN]</value> </list> </property> </bean>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"> <value>java:/[yourdatasource]<value> </property> </bean>
<!-- Now you can use set the sessionFactory as property of your service class and use it to query the database --> <bean id="yourservice" class="[yourserviceclass]"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> |
|
Mathias - I Know What [you] Did Last Summer!
|
|
|
Mr_Light
|
 |
«
Reply #7 - Posted
2006-10-18 07:28:22 » |
|
your not using spring's stuff for transactions then cylab? http://www.springframework.org/docs/reference/transaction.htmlas long as I'm consistent in appling on wenn and how collections should be loaded I'm ok.
|
It's harder to read code than to write it. - it's even harder to write readable code.
The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
|
|
|
cylab
|
 |
«
Reply #8 - Posted
2006-10-18 08:04:49 » |
|
your not using spring's stuff for transactions then cylab?
I was not in the project I took the example from. Normally we do. as long as I'm consistent in appling on wenn and how collections should be loaded I'm ok.
We persist a complete data model of a fairly complex application with a lot of interdependencies and some custom types using hibernate, so we mostly have to use lazy loading and reduce cascades to prevent hibernate from reading the whole database . What makes the situation worse is the use of hibernate enhanced data objects in form beans, so there are some catches, since the hibernate session could already be closed when accessing a lazy loaded property etc. etc. (...)wenn(...)
Hallo Landsmann 
|
Mathias - I Know What [you] Did Last Summer!
|
|
|
Mr_Light
|
 |
«
Reply #9 - Posted
2006-10-18 21:46:36 » |
|
Hallo Landsmann?  I'm probebly beeing dense.
|
It's harder to read code than to write it. - it's even harder to write readable code.
The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
|
|
|
Games published by our own members! Check 'em out!
|
|
cylab
|
 |
«
Reply #10 - Posted
2006-10-19 06:12:40 » |
|
Hallo Landsmann?  I'm probebly beeing dense. Nevermind, just a misconception. It's a common mistake for a german to write "wenn" instead of "when", so I thought you must be german.
|
Mathias - I Know What [you] Did Last Summer!
|
|
|
Mr_Light
|
 |
«
Reply #11 - Posted
2006-10-19 10:13:58 » |
|
ne I'm dutch and dyslectic, so yer close. 
|
It's harder to read code than to write it. - it's even harder to write readable code.
The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
|
|
|
cylab
|
 |
«
Reply #12 - Posted
2006-10-19 11:01:56 » |
|
|
Mathias - I Know What [you] Did Last Summer!
|
|
|
ENC
|
 |
«
Reply #13 - Posted
2006-10-20 01:53:43 » |
|
Another question... Spring and Hibernate are linked via XML correct? SO in that case Struts , Spring and Hibernate also can be joint as one application correct? However my friend insist that is not possible cause he has tried. He even bet with me 300 bucks if I can come up with an application which conisist of all three frameworks together... PS: I don't feel like losing 300 bucks  Cheers!
|
|
|
|
cylab
|
 |
«
Reply #14 - Posted
2006-10-20 06:07:51 » |
|
|
Mathias - I Know What [you] Did Last Summer!
|
|
|
Mr_Light
|
 |
«
Reply #15 - Posted
2006-10-20 21:22:57 » |
|
Another question... Spring and Hibernate are linked via XML correct? SO in that case
IoC is configured though xml (most of the time, annotations are possible too) Struts , Spring and Hibernate also can be joint as one application correct? However my friend insist that is not possible cause he has tried. He even bet with me 300 bucks if I can come up with an application which conisist of all three frameworks together... PS: I don't feel like losing 300 bucks  Cheers! struts can be plugged into spring as a view component. As I pointed out in my other msg in this thread try linking it and it will get messy, he probebly tried to start the spring container from struts. Which will work but leads to all kinds of issues. http://64.233.183.104/search?q=cache:Q56Fv_ntmNAJ:www.springframework.org/node/267+spring+%226.+Birthdate+-+demonstrates+Struts+integration.%22&hl=en&ct=clnk&cd=1also see the attachment I extracted the example from the release. (rename to birthdate.rar) has anyone fiddled with JSR 170 and jackrabbit? I just came across it I found that the ppl at spring where already working on it http://forum.springframework.org/showthread.php?t=17763&page=3
|
It's harder to read code than to write it. - it's even harder to write readable code.
The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
|
|
|
ENC
|
 |
«
Reply #16 - Posted
2006-10-23 02:10:44 » |
|
I renamed it... but cannot be open?
|
|
|
|
Mr_Light
|
 |
«
Reply #17 - Posted
2006-10-23 06:56:45 » |
|
yeah it seems to be corrupted java-gaming.org seems quite unstable from here. http://prdownloads.sourceforge.net/springframework/spring-webflow-1.0-rc4.zipI though it was in there.
|
It's harder to read code than to write it. - it's even harder to write readable code.
The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
|
|
|
ENC
|
 |
«
Reply #18 - Posted
2006-10-26 07:22:18 » |
|
It seems that the classes which they use here are not from the original springframework is there any examples that uses from the default springframework... (Classes which are specified in SpringFramework 2.0) By the way... I already lost my 300 bucks... so sad.
|
|
|
|
|