Encapsulation levels in Java Enterprise Project - mysql

I am working on an enterprise level project. DB is in MySQL and project uses Maven, Hibernate and Spring MVC. I've gotten through defining the data models now I need to start implementation.
My question is, is it better to create the service and implementation layers in separate projects or should they be in the same project as the data model layer? What are the pros and cons and how should I go about it please?

If it is just a web app and you won't share any code with other applications, then just put entities in one package, controllers in another package and so on. No need to create multiple projects. If your application is going really big or you have to share code with other projects, then you can think of separating.

Related

Building a Xamarin Forms App using MySQL

I would like to build a mobile version of a household financial planner web app that I built with MVC, C#, MS SQL, and Entity Framework. What I've learned from my research is that I should communicate with the database for this project using API endpoints. I am familiar with setting up a WebAPI with MS SQL, but not MySQL. Also, the little work that I have done in that field was based on only retrieving information from the database. Not adding application users, roles, or any rows to tables. The web application that I'm trying to base this Xamarin application is at http://abacus.travismcdaniel.me
I have been unable to find a guide our tutorial that teaches what I need to know. In fact, most of the guides I've found are so outdated that I can't follow the steps because the things they say to do simply don't exist anymore.
So my question is this: It's there a n up-to-date guide anywhere that can walk me through the basics of setting up a MySQL database to use with the app that I'm building, then walk me through writing stored procedures, seeing up WebAPI endpoints for those stored procedures, and then incorporating all of that into a Xamarin Forms application?
If there isn't one single guide that does this, are there a few (still up-to-date) that I can work through to get the same information? Thank you in advance.

MySQL Workbench Model to Java Persistence Entity

I am designing a database using MySQL Workbench. I've defined a bunch of tables and set up relationship via foreign keys. I am preparing to forward engineer this model to a database schema. Where do I go from there?
What I am looking to do is take the new database and create the Java entities that will correspond to said tables for use in a SpringBoot application. I have seen a few posts that talk about different methods including Eclipse-based solutions that generate these artefacts, but many of these are older solutions and I'm not sure what the current "hot" tool is. Using Spring Source Tool Suite, I installed JBoss Tools which claims to do this via their Hibernate Tools Reverse Engineering utility, but I can't find any step-by-step documentation on how to proceed.
Since the project is in its infancy, I expect frequent changes to be made to the model and would like to consider a solution that can handle those types of updates as well.
In addition to the utilities listed in the comments, there are a couple of other possibilities I want to mention:
Maven Archetypes - Maven-based templating toolkits that can generate projects according to different configurations
JHipster - Yeoman-based templating toolkit that can generate opinionated best-practice Spring-Boot monolithic or microservice applications.
Number 2 is currently my go-to solution as it has a very active community and does a lot of "cool stuff".

JSP, MySQL and Geronimo

The task is to create several JSPs, in which the user would be able to interact by inputting information, which would be saved on a database server, so the info can be called up later.
I'm not sure if this question is constructive enough or not, but I have no idea how to even start. I know what each one of the components means, but that's about it. I have no idea how the whole process works and I don't know what's it called, so I can't even search for it properly.
Could anyone briefly describe the process from start to finish how this system would work and what should be my first concern? I'm more interested in the JSP hosting (would Tomcat be a better choice, or is Geronimo much better in my case) and the connection of JSP to the database.
You need several components and layers for an application like that, so the first thing to do is select your technology stack so you don't reinvent the wheel and adopt best practices that your frameworks include. My choice, is Spring Framework.
Your JSP's represent the View Layer of your app. You can use JavaScript/AJAX to embelish your forms and sent data to your server.
The data that the user enters in the form is received and processed by the Controller Layer. Spring MVC has some neat collection of controllers for you to use. Once the data es ready, you can pass it to the Service Layer to execute Business Logic.
The Service Layer contains Business Logic rules. Spring Framework let this Layer to be simple POJO's, and to apply Transactional logic if you wish. It's highly probable that Service Layer requires to persist some data in the Database, so it invokes the DAO layer.
The classes in DAO layer have the responsability of storing data in the database. You can use several frameworks for this, and Spring supports many of them. Also, Spring includes some inherent JDBC support with templates included.
With that you can start your project. It should run with no problems in Tomcat, Geronimo or any Java EE Container

WCF: Best way to get data from Oracle 10g, MySQL and SQL Server 2008 databases?

I am designing a simple C# WCF service using ASP.NET 4.0 and hosted on IIS7, which will be used by .NET and Java web applications and desktop applications to extract data stored in various databases (both local and remote). I am starting to learn how to use VS2010 and WCF after working for a few years on VS2005 and asp.net web services, so am somewhat of a noob to WCF but know a bit about web services and Visual Studio.
Does anyone have opinions on what the best approach would be in terms of project/class/file setup in Visual Studio 2010 to do this, seeing as how I want to maximize code re-use and minimize development time yet still have the ability to connect to the different databases? I have a WCF Service Application project for the service, and have generated a WCF Client to use for testing using svcutil.exe, but now I'm at the point where I need to start writing database access layer code (or "model" code for MVC if that's the design route I need to go down).
Any help appreciated, thanks!
Each of the databases will have their set of nuisances while integration. The first thing you need to start with would be to design your model in more of OO (Object Oriented) fashion than relation DB way. Once such a model is created, you need to implement mapper layer/classes that would map data from a relational form to a OO format. Then for each DB you need to write some data access code. The amount of code you write for data access may well depend upon the tools\technologies you use. You could look into Entity Framework or NHibernate or other such ORMs to decrease the code required to access data. But keep in mind these ORM mappers may require their own set of tweaks to work well with MySQL, Oracle, SQL Server.

Best way to take advantage of .NET 3.5

I currently have an asp.net web application which is using seperate assemblies for the data access, the business logic,
entity objects, and the web user interface. The data access was created using Microsoft's Data Access Application Block
compilied as a .NET 2.0 assembly. Stored procedures were used for the actual moving of data in and out of the database
(SQL 2005).
I would like to update this application to a take advantage of the new features of .NET 3.5 such as Linq, data entities,
etc. What would be the best approach to make this happen?
I was doing some research about this topic and I found this article very useful.
http://blogs.msdn.com/dsimmons/archive/2008/05/17/why-use-the-entity-framework.aspx
Obviously, .net 3.5 has lots of new features if you compare to 2.0. one of them as you stated Linq(to SQL and to XML). which enables you to write strongly-typed language integrated queries. as you may know as well as querying your entities by using LINQ, you can query your collections and XML files.
Also you can use ADO.NET entity framework for mapping your database tables to classes. I am not sure about performance aspect. u might need to do some investigation about it.
dont forget to do your regression tests after you have developed new version of your application.
I know it is general information... I hope it helps.
Cheers