Skip to content

Instantly share code, notes, and snippets.

View seycileli's full-sized avatar
🧑‍💻
< Focused />

Sey' Adem Cileli seycileli

🧑‍💻
< Focused />
View GitHub Profile
@seycileli
seycileli / application.properties
Last active April 3, 2024 15:48
Spring Boot – DataSource Configuration / application.properties example
<!-- MAKE SURE TO ADD DATABASE DEPENDENCY IN POM.XML -->
# H2
spring.datasource.url=jdbc:h2:file:C:/temp/test
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driverClassName=org.h2.Driver
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
# MySQL
@seycileli
seycileli / CrudRepo.java
Last active July 27, 2020 16:20
How To: Create a Crud Repository [JAVA]
/**
* Make life easier with this simple step!!
*
* Create an interface that extends one of your Entity classes
* Then import the following below, after your entity class name
*/
import org.springframework.data.repository.CrudRepository;
public interface EntityClass extends CrudRepository<EntityClass> {
@seycileli
seycileli / persistence.xml
Last active January 24, 2020 01:47 — forked from mortezaadi/persistence.xml
persistence xml configurations for major databases and jpa providers
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<!-- derby -->
@seycileli
seycileli / hibernate.cfg.xml
Last active January 23, 2020 21:42
How To Create hibernate.cfg.xml
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE hibernate-configuration SYSTEM
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name = "hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</property>
@seycileli
seycileli / dispatcher-servlet.xml
Last active January 31, 2020 17:55
How to create dispatcher-servlet.xml in IntelliJ IDE
Right click WEB-INF folder | NEW | FILE
name file dispatcher.xml || dispatcher.servlet.xml
insert the follow code;
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@seycileli
seycileli / persistence.xml
Last active January 13, 2020 21:31
Main way to write and always use a persistence.xml file and connecting to a database
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="any-name-you-want-here">
<!-- The persistence-unit name can be whatever you like -->
<!-- This is the BRAIN of our project -->
<!-- ADD (CLASSES) ENTITIES /OR MODELS CREATED FOR BY ME FOR MY APP -->
@seycileli
seycileli / persistence.xml
Created January 13, 2020 00:43
MySQL & Hibernate in persistence.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"
version="2.2">
<persistence-unit name="org.hibernate.example.jpa" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.packagename.classname</class> <!-- add each new created package name below this -->