• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Persisting model

 
Aleksandar Mitrev
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm creating application who contains two model class Student and Grade and using org.springframework.orm.hibernate3.LocalSessionFactoryBean to persist them
The two model class and the relation between them is:


I've manage to persist the two classes separable with out the relation between(the composition in Student class)
I'm wondering is there something like

that like a state to put it in the hibernate-mapping and make the persistence with the corresponding relation.
I'm not using JPA Annotation in the model and my tables in the database are

Student table:


Grade table:
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you just add the association mapping to your mapping.

See the Hibernate documentation for xml mapping of associations here
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/associations.html#assoc-unidirectional

I am also going to move this to the ORM forum as this isn't a Spring question. Thanks

Mark
 
Aleksandar Mitrev
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark Spritzler wrote:Well, you just add the association mapping to your mapping.

See the Hibernate documentation for xml mapping of associations here
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/associations.html#assoc-unidirectional

I am also going to move this to the ORM forum as this isn't a Spring question. Thanks

Mark


Thanks mark your reply gave me direction what my mistake is
I was getting error on one-to-many declaration and a assuming that my mistake is there but actual my mistake was that I've didn't added the spring-jpa jar
Thanks again
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aleksandar Mitrev wrote:
Mark Spritzler wrote:Well, you just add the association mapping to your mapping.

See the Hibernate documentation for xml mapping of associations here
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/associations.html#assoc-unidirectional

I am also going to move this to the ORM forum as this isn't a Spring question. Thanks

Mark


Thanks mark your reply gave me direction what my mistake is
I was getting error on one-to-many declaration and a assuming that my mistake is there but actual my mistake was that I've didn't added the spring-jpa jar
Thanks again


Sweet. Good Job.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic