Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » scout + springdata jpa
scout + springdata jpa [message #1743175] Tue, 13 September 2016 01:11 Go to next message
xiang yz is currently offline xiang yzFriend
Messages: 12
Registered: August 2016
Junior Member
Hi, everyone,
I want to use spring data jpa to access database with my scout project(6.0.0.RC4), is there any examples?
Re: scout + springdata jpa [message #1743590 is a reply to message #1743175] Fri, 16 September 2016 15:35 Go to previous messageGo to next message
Judith Gull is currently offline Judith GullFriend
Messages: 75
Registered: February 2010
Member
Maybe this talk might be of interest for you: https://www.eclipsecon.org/europe2016/session/building-full-stack-applications-open-source-technologies
Re: scout + springdata jpa [message #1743868 is a reply to message #1743590] Tue, 20 September 2016 10:12 Go to previous messageGo to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 191
Registered: November 2014
Senior Member

Hi there,

I'd be interested in this topic too. Perhaps JPA persistence in general.

Is there a simple way to map AbstractFormData objects to JPA entity objects?

Peter
Re: scout + springdata jpa [message #1743899 is a reply to message #1743868] Tue, 20 September 2016 13:19 Go to previous messageGo to next message
Matthias Zimmermann is currently offline Matthias ZimmermannFriend
Messages: 206
Registered: June 2015
Senior Member
we are currently in the process of building such an example [1]. warning: it's still early stage. basically in this combination of Spring Boot (and Spring Data) and Scout we will only use a Scout client that is bundled with the Spring server (and not use a Scout server). so in this case form data objects are not useful and will not be used. instead, model data will be manually mapped to form fields in the form handlers.


  • form data objects are driven by the form design (the ui perspective) and are meant to serve as communication objects between the Scout client and server
  • jpa entities are usually derived from the business model (the business perspective) and only in trivial cases the two perspectives are a good match
  • typically, some manual mapping from the model needs to be done to the forms/pages/...


from this follows that directly mapping form data objects and jpa entities is not recommended (and not directly supported by the Scout framework). in case you would still need something you might want to follow the implementation of AbstractForm.{import|export}FormData.

[1] https://github.com/BSI-Business-Systems-Integration-AG/SpringBoot-and-EclipseScout
Re: scout + springdata jpa [message #1743969 is a reply to message #1743899] Wed, 21 September 2016 08:10 Go to previous messageGo to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 191
Registered: November 2014
Senior Member

Hi,

thanks for the answer. So basically you are doing the manual mapping for every form/page when retrieving data via JPA? I had hoped that there was some kind of automatic way possible for this cumbersome tasks.

Have you ever heard of ModellMapper and tools like this? Would they be of some help?

Peter

Re: scout + springdata jpa [message #1746464 is a reply to message #1743899] Sat, 29 October 2016 17:31 Go to previous messageGo to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 191
Registered: November 2014
Senior Member

Hi there,

Matthias Zimmermann wrote on Tue, 20 September 2016 13:19
we are currently in the process of building such an example [1]. warning: it's still early stage. basically in this combination of Spring Boot (and Spring Data) and Scout we will only use a Scout client that is bundled with the Spring server (and not use a Scout server). so in this case form data objects are not useful and will not be used. instead, model data will be manually mapped to form fields in the form handlers.


  • form data objects are driven by the form design (the ui perspective) and are meant to serve as communication objects between the Scout client and server
  • jpa entities are usually derived from the business model (the business perspective) and only in trivial cases the two perspectives are a good match
  • typically, some manual mapping from the model needs to be done to the forms/pages/...


[1] https://github.com/BSI-Business-Systems-Integration-AG/SpringBoot-and-EclipseScout


I looked at the code @github and I wondered, where the magic happens, where the Scout UI is called instead of Controller methods by Spring Boot?

Can someone please shed light on this topic for me?

Thanks

Peter
Re: scout + springdata jpa [message #1746651 is a reply to message #1743899] Wed, 02 November 2016 13:42 Go to previous messageGo to next message
Santo Mota is currently offline Santo MotaFriend
Messages: 62
Registered: July 2013
Member
Matthias Zimmermann wrote on Tue, 20 September 2016 13:19
we are
from this follows that directly mapping form data objects and jpa entities is not recommended (and not directly supported by the Scout framework). in case you would still need something you might want to follow the implementation of AbstractForm.{import|export}FormData.
[1] https://github.com/BSI-Business-Systems-Integration-AG/SpringBoot-and-EclipseScout



So, if we can't use a JPA or any other ORM, how BSI CRM works, when it referers to multiple connetions?
How do you adapte your aplication when customers wants to use different data base? do you override your select for every data base like posgretsql, slq, oracle and so on?
Or do you use some technique to adapter the software?
Re: scout + springdata jpa [message #1746660 is a reply to message #1746651] Wed, 02 November 2016 14:52 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1243
Registered: October 2011
Senior Member
In some Scout Application I know, there is 2 layers in the Backend Server App:

* BaseService:
This one connects to the database with using an ORM.
The services and operations in this layer are really Database/Tables driven.

* ProcessService / PageService / OutlineService:
This one prepares the Scout Data Transfert Objects (PageData, FormData) for the Scout UI Server.
It does some mappings between the DB Objects and the DTO.

Sometimes I consider that this approach requires a lot of (glue) code for a simple problems. But if you are consistent in your code, it becomes easy to understand and to maintain.

In most of the cases you do not want the pages and the forms in your app matching 1:1 the DB tables.

----

If you use the simple JDBC layer provided by Scout you will also use a connection pool and prepared statement (if you use the Scout Binds).
The problem with this approach is that you write plain text SQLs as String (SQL Errors only at runtime & dependency to a specific database)
=> In some cases, this is just good enough...

Something I wanted to investigate:
With frameworks like jooq or QueryDSL let them represent your database as Java Objects and use theme to build statements that maps directly to Scout FormData/PageData Objects.

Previous Topic:Customize Code Generation
Next Topic:Any Doc. to Connect to MySQL
Goto Forum:
  


Current Time: Sun Oct 22 01:17:55 GMT 2017

Powered by FUDForum. Page generated in 0.01766 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software