JCart: Create JPA Entities

We are going to create the JPA Entities for the database tables we designed. @Entity @Table(name="users") public class User { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Integer id; @Column(nullable=false) @NotEmpty() private String name; @Column(nullable=false, unique=true) @NotEmpty @Email(message="{errors.invalid_email}") private String email; @Column(nullable=false) @NotEmpty @Size(min=4) private String password; private String passwordResetToken; @ManyToMany(cascade=CascadeType.MERGE) @JoinTable( name="user_role", joinColumns={@JoinColumn(name="USER_ID", referencedColumnName="ID")}, inverseJoinColumns={@JoinColumn(name="ROLE_ID", referencedColumnName="ID")}) private List<Role> roles; //setters & getters } @Entity @Table(name="roles") public class Role { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Integer id; @Column(nullable=false, unique=true) @NotEmpty private String name; @Column(length=1024) private String description; @ManyToMany(mappedBy="roles") private List<User> users; @ManyToMany @JoinTable( name="role_permission", joinColumns={@JoinColumn(name="ROLE_ID", referencedColumnName="ID")}, inverseJoinColumns={@JoinColumn(name="PERM_ID", referencedColumnName="ID")}) private List<Permission> permissions; //setters & getters } @Entity @Table(name="permissions") public class Permission { @Id @GeneratedValue(strategy=GenerationType.

Continue reading »

JCart: Domain Modelling and Database Designing

While developing database driven applications using some ORM framework, some people prefer Object first approach and others follow DB first approach. I prefer DB first approach. So, let us start listing down all the domain entities in our JCart application domain. Product Category Customer Order OrderItem Cart Address User Role Permission Let us create the database tables as follows: Though we identified Cart as a domain entity, we are not creating the table for holding the Cart details.

Continue reading »

JCart: Initial Code SetUp

Let us create a root pom type maven project with 3 sub-modules jcart-core, jcart-admin and jcart-site. jcart-core module will contain all the core logic excluding web related stuff. jcart-admin module will contain all the administration related web functionality like Controllers, Security, Validators etc. jcart-site module will contain all the shoppingcart related web functionality like Controllers, Security, Validators etc. All these modules use SpringBoot, but as of now STS/IntellijIdea are not providing option to create multi-module SpringBoot application, we will be creating Maven modules and then configure SpringBoot dependencies manually.

Continue reading »

JCart : Iteration-1

Now that we have completed the most difficult part (writing Introduction to technical article series is much harder than you think!!), so let’s start the fun part. Coding!!! Note: It is going to be a fast paced tutorial. Obviously we can’t cover every little bit of all the technologies used in our application. So I would suggest to explore more on individual technologies like Spring, Thymeleaf on your own. I would strongly suggest to checkout the code from https://github.

Continue reading »

Setting up the Development Environment for JCart

For our JCart application development we will be using the following Softwares/Tools. JDK 8 SpringSource Tool Suite (STS) MySQL Git Maven Jenkins SonarQube Apache/Nginx WebServer I am not going to explain how to install JDK or MySQL because there are plenty of articles you can find on internet. If you are using Ubuntu based Linux Operating System then you can refer my article My Development Environment Setup on Linux to setup Java development tool chain.

Continue reading »

JCart Release Planning

In our previous article JCart Requirements Analysis we have listed out all the requirements that we need to implement for JCart application. Now we need to come up with an implementation and release plan. As we are following iteration model, we will plan for N iterations where in each iteration we will implement some usecases. After listing out all the implementation tasks and based on the task dependencies, we came up with the following Iteration plan.

Continue reading »

Developing a simple e-commerce application from scratch to production using SpringBoot

We can find plenty of information on any technical topic, be it Java, .NET, Python or any frameworks like Spring, Hibernate, CDI, JSF etc. You can find hundreds of well written blogs on many of these topics. For example, you can find lot of tutorials on how to use SpringBoot or how to use various mappings in JPA/Hibernate or how to do form validations in JSF etc. Also, there are plenty of books published by well established publishers on most of the technologies.

Continue reading »