Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Architecture to small admin software? Suggestions
What is the best solution for small admin software? I have a MySQL database (10 tables, one to many connections etc.) and 5 Vaadin Forms, but I have no idea what is the best architecture to other layers than Vaadin. Just SQLContainer or Spring + Hibernate or JPA or something else. Because you have more experience than I've got, could you pls help me and suggest something and tell me little bit why and what? I tried Spring Roo, but I think that, the add on is not ready enough.
Best architectural choices depend on so many things that it is dangerous to go saying something on these details. E.g. expected maintenance needs and developers existing skills can be essential arguments. Still I'd favor ORM instead of pure SQL and EclipseLink instead of Hibernate (better suited for state full apps).
Hi. As Matti said, it can't really be said what is the best practice. Personally I've seen pretty much everything from native use of SQL and self made DAO's to container managed EJB/JPA transactions.
I think one of the key points is to make clear separation between UI and backend logic and have just one point of traffic between them. For example for different editors you could have separate backend EJB implementations that would internally use the backing database through JPA. In the backend side you have JPA entities for example and all the database modifications are done within transactions started when UI makes calls to EJB beans. if somethings fails to update transaction is rolled back and database consistency is maintained.
Then for the UI you could have DTO's that contain the 'minimum required data' that is needed in the UI. For example if multiple editors use properties of one entity but not all of them, you could have separate DTO for each view that would be used to send the modifications and data back and forth with the EJBs.
Then on the otherhand, if you want to keep it simple, you can just as well transfer the detached entity from backend to UI. If using Hibernate just remember not to call methods that utilize lazyloading as entities are detached from the EntityManager and therefore outside the session scope. As Matti mentioned, Eclipse Link provides better support for this. Then again, if you go with the DTO's you don't have the whole problem in the firstplace.
If you don't want to use EJB + JPA + CMT transactionality, then you could just write really simple DAO's your self and with SQL just get the data you need, pack it to pojo and give it to UI's form for modification.