Skip to content

Commit 32ad708

Browse files
committed
hibernate: Setup initial project structure
1 parent 730b19a commit 32ad708

File tree

6 files changed

+105
-0
lines changed

6 files changed

+105
-0
lines changed

java/hibernate/.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Gradle
2+
# ------
3+
.gradle
4+
/build
5+
/buildSrc/build
6+
/subprojects/*/build
7+
/subprojects/docs/src/samples/*/*/build
8+
9+
# IDEA
10+
# ----
11+
.idea
12+
.shelf
13+
/*.iml
14+
/*.ipr
15+
/*.iws
16+
/buildSrc/*.iml
17+
/buildSrc/*.ipr
18+
/buildSrc/*.iws
19+
/buildSrc/out
20+
/out
21+
/subprojects/*/*.iml
22+
/subprojects/*/out

java/hibernate/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2016 The Cockroach Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+
# implied. See the License for the specific language governing
13+
# permissions and limitations under the License. See the AUTHORS file
14+
# for names of contributors.
15+
#
16+
# Author: Nathan VanBenschoten ([email protected])
17+
18+
.PHONY: start
19+
start:
20+
@gradle run

java/hibernate/build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
group 'com.cockroachlabs'
2+
version '1.0'
3+
4+
apply plugin: 'java'
5+
apply plugin: 'application'
6+
7+
mainClassName = 'com.cockroachlabs.Application'
8+
sourceCompatibility = 1.7
9+
10+
repositories {
11+
mavenCentral()
12+
}
13+
14+
dependencies {
15+
compile 'org.hibernate:hibernate-core:5.2.0.Final'
16+
compile 'org.postgresql:postgresql:9.4.1208'
17+
18+
testCompile group: 'junit', name: 'junit', version: '4.11'
19+
}

java/hibernate/settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
rootProject.name = 'Hibernate'
2+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.cockroachlabs;
2+
3+
public class Application {
4+
5+
public static void main(String[] args) {
6+
7+
}
8+
9+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<!DOCTYPE hibernate-configuration PUBLIC
3+
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
4+
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
5+
6+
<hibernate-configuration>
7+
8+
<session-factory>
9+
10+
<!-- Database connection settings -->
11+
<property name="connection.driver_class">org.postgresql.Driver</property>
12+
<property name="connection.url">jdbc:postgresql://127.0.0.1:26257/company?sslmode=disable</property>
13+
<property name="connection.username">root</property>
14+
<property name="connection.password"></property>
15+
16+
<!-- JDBC connection pool (use the built-in) -->
17+
<property name="connection.pool_size">1</property>
18+
19+
<!-- SQL dialect -->
20+
<property name="dialect">org.hibernate.dialect.PostgreSQL94Dialect</property>
21+
22+
<!-- Echo all executed SQL to stdout -->
23+
<property name="show_sql">true</property>
24+
25+
<!-- Drop and re-create the database schema on startup -->
26+
<property name="hbm2ddl.auto">validate</property>
27+
28+
<!-- org.hibernate.HibernateException: No CurrentSessionContext configured! -->
29+
<property name="hibernate.current_session_context_class">thread</property>
30+
31+
</session-factory>
32+
33+
</hibernate-configuration>

0 commit comments

Comments
 (0)