Skip to content

Instantly share code, notes, and snippets.

View Ikhiloya's full-sized avatar

Ikhiloya Ikhiloya

View GitHub Profile
@Ikhiloya
Ikhiloya / pom.xml
Created June 21, 2018 21:51
ojdbc dependency
<!--Oracle database driver -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0</version>
</dependency>
@Ikhiloya
Ikhiloya / pom.xml
Created June 21, 2018 22:00
pom.xml file for spring-boot--jpa-oracle tutorial
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.loya</groupId>
<artifactId>spring-jpa-oracle-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
@Ikhiloya
Ikhiloya / application.properties
Created June 21, 2018 22:07
properties file for spring-boot-jpa-oracle tutorial
## use create when running the app for the first time
## then change to "update" which just updates the schema when necessary
spring.jpa.hibernate.ddl-auto=create
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
spring.datasource.url= jdbc:oracle:thin:@localhost:1521:XE
spring.datasource.username=system
spring.datasource.password=changeme
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
## this shows the sql actions in the terminal logs
spring.jpa.show-sql=true
@Ikhiloya
Ikhiloya / UserDao.java
Created June 21, 2018 22:14
Dao for spring-boot-oracle tutorial
@Repository
public interface UserDao extends JpaRepository<User, Integer> {
}
@Ikhiloya
Ikhiloya / mavencmd.txt
Created June 21, 2018 22:24
maven run commands
mvn clean package && mvn spring-boot:run
@Ikhiloya
Ikhiloya / mavennstall.txt
Created June 21, 2018 22:27
command to install ojdb for jqava
mvn install:install-file -Dfile={Path/to/your/ojdbc7.jar} -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0 -Dpackaging=jar
@Ikhiloya
Ikhiloya / mavennstall.txt
Created June 21, 2018 22:27
command to install ojdb for jqava
mvn install:install-file -Dfile={Path/to/your/ojdbc7.jar} -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0 -Dpackaging=jar
@Ikhiloya
Ikhiloya / UserController.java
Last active June 23, 2018 09:26
controller class for spring-boot-jpa-oracle tutorial
@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
UserService userService;
@RequestMapping(value = "/all", method = RequestMethod.GET)
public List<User> getAllUsers() {
return userService.getAllUsers();
}
@Ikhiloya
Ikhiloya / UserService.java
Last active June 23, 2018 09:37
service class for spring-boot-jpa-oracle tutorial
@Service
public class UserService {
@Autowired
UserDao userDao;
public List<User> getAllUsers() {
return this.userDao.findAll();
}
public User addUser(User user) {
@Ikhiloya
Ikhiloya / User.java
Last active June 23, 2018 09:39
user entity for spring-boot-jpa-oracle tutorial
@Entity
@Table(name = "USER_TABLE")
public class User {
@Column(name = "ID")
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@Column(name = "USER_NAME", nullable = true, length = 255)
private String name;