December 2019
Intermediate to advanced
494 pages
11h 41m
English
Another option when it comes to connecting to your Azure SQL Database is using JPA. Create another Gradle project and configure Gradle, as shown here:
apply plugin: 'java-library' repositories { jcenter() } dependencies { implementation 'org.hibernate:hibernate-entitymanager:5.3.7.Final' runtime 'com.microsoft.sqlserver:mssql-jdbc:7.0.0.jre8' }
Create an Entity class to represent a Person:
package com.packtpub.azure import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "Person") public class Person { @Id @Column(name = "Id") private Integer id; // [...] public Integer getId() { return id; } public Person setId(Integer id) { this.id = id; return this; } // [...] }
Now we will recreate the previous ...