This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes [Stripes] @ManyToOne relationships: NULL id Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "[Stripes] @ManyToOne relationships: NULL id" Watch "[Stripes] @ManyToOne relationships: NULL id" New topic

[Stripes] @ManyToOne relationships: NULL id

Gabriele Fabbri
Ranch Hand

Joined: Dec 05, 2008
Posts: 30

I'm posting here because I think that my problem is, in this case, more related with the Stripersist library than Hibernate.
I have two entities with a @ManyToOne relationship: ServizioCat (this is the "category", the parent object) and Servizio.
Due to the @ManyToOne annotation, I got a specific column (servizioCat_id) in the servizio database table (created by Hibernate).
The problem is that when I create a new Servizio object and I save it, I get a NULL value into the servizioCat_id field.
I think I'm forgetting something (I'm following the Stripes Book tutorial).

This is the ServizioCat class (parent):

This is the Servizio class:

Do you have any idea?
Please let me know if you need to view more code.

Thank you in advance,

OverZero Software
Gabriele Fabbri
Ranch Hand

Joined: Dec 05, 2008
Posts: 30
Ok, I solved the problem.

I just added another hidden field in the form jsp and then I put getter and setter in the ServizioBaseActionBean class.
It works perfectly now!

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: [Stripes] @ManyToOne relationships: NULL id
It's not a secret anymore!