-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Hibernate model in a multi-request HTTP conversation
PostPosted: Wed May 10, 2017 5:43 pm 
Beginner
Beginner

Joined: Sun May 07, 2017 11:24 pm
Posts: 29
Hi All,

I have a web project that involves the following relationship:

Episode has a 1:1 with Plan, and Plan has a 1:Many with Task.

The project is setup in Springboot and Thymeleaf.

Episode has its own webpage for displaying and entering new Episodes. I also have a webpage for displaying and entering plans (havent got to task yet).

In terms of wiring it all up, a plan is accessed form the Episode webpage and will send the user to a new page.

I wanted to check however that the same episode that is in the Episode webpage should be added to the model for the plan page?

Cheers

Al


Top
 Profile  
 
 Post subject: Re: Hibernate model as it relates to HTML setup
PostPosted: Thu May 11, 2017 1:31 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
If you have a web flow made out of multiple steps, then you should have a single Model across all pages. If you have multiple tabs that might operate on the same data, then you could advise the users to submit their pending changes prior to switching to a new table. This way, you can commit the current changes, and always fetch the updated data from the DB.


Top
 Profile  
 
 Post subject: Re: Hibernate model as it relates to HTML setup
PostPosted: Thu May 11, 2017 1:58 am 
Beginner
Beginner

Joined: Sun May 07, 2017 11:24 pm
Posts: 29
Thanks Vald,

Good tip about the saving.

Is the passing of the object done through session parameter or by passing it in path or ???

AL


Top
 Profile  
 
 Post subject: Re: Hibernate model as it relates to HTML setup
PostPosted: Thu May 11, 2017 4:10 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
It's usually a good idea to take advantage of the Http Session storage as it's easier to retain a given entity as-is between the read and the write HTTP requests. If you use Java EE, you can even use a Stateful EJB.

If your architecture relies on stateless web containers, then your only option is to marshall entities as JSON on the client side and send them back as POST/PUT parameters back to the server to reconstruct the entities.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.