删除编译错误
This commit is contained in:
parent
48d168a628
commit
daf9db188d
@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
||||
<entry key="Project Default">
|
||||
<profile-state>
|
||||
<expanded-state>
|
||||
<State />
|
||||
<State>
|
||||
<id>Android</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>CorrectnessLintAndroid</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Java</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Java language level migration aidsJava</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>LintAndroid</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>PerformanceLintAndroid</id>
|
||||
</State>
|
||||
</expanded-state>
|
||||
<selected-state>
|
||||
<State>
|
||||
<id>Android</id>
|
||||
</State>
|
||||
</selected-state>
|
||||
</profile-state>
|
||||
</entry>
|
||||
</component>
|
||||
</project>
|
2
persistence-modules/hibernate-annotations/.idea/.gitignore
generated
vendored
2
persistence-modules/hibernate-annotations/.idea/.gitignore
generated
vendored
@ -1,2 +0,0 @@
|
||||
# Default ignored files
|
||||
/workspace.xml
|
@ -1,6 +0,0 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<option name="RIGHT_MARGIN" value="140" />
|
||||
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
|
||||
</code_scheme>
|
||||
</component>
|
@ -1,5 +0,0 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="hibernate-annotations" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="hibernate-annotations" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: antlr:antlr:2.7.7">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/antlr/antlr/2.7.7/antlr-2.7.7.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/antlr/antlr/2.7.7/antlr-2.7.7-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/antlr/antlr/2.7.7/antlr-2.7.7-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: ch.qos.logback:logback-classic:1.1.7">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: ch.qos.logback:logback-core:1.1.7">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.experlog:xapool:1.5.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/experlog/xapool/1.5.0/xapool-1.5.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/experlog/xapool/1.5.0/xapool-1.5.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/experlog/xapool/1.5.0/xapool-1.5.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.fasterxml:classmate:1.3.4">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/classmate/1.3.4/classmate-1.3.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/classmate/1.3.4/classmate-1.3.4-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/classmate/1.3.4/classmate-1.3.4-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.h2database:h2:1.4.200">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/h2database/h2/1.4.200/h2-1.4.200.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/h2database/h2/1.4.200/h2-1.4.200-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/h2database/h2/1.4.200/h2-1.4.200-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.sun.istack:istack-commons-runtime:3.0.7">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/istack/istack-commons-runtime/3.0.7/istack-commons-runtime-3.0.7.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/istack/istack-commons-runtime/3.0.7/istack-commons-runtime-3.0.7-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/istack/istack-commons-runtime/3.0.7/istack-commons-runtime-3.0.7-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.sun.xml.fastinfoset:FastInfoset:1.2.15">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/xml/fastinfoset/FastInfoset/1.2.15/FastInfoset-1.2.15.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/xml/fastinfoset/FastInfoset/1.2.15/FastInfoset-1.2.15-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/xml/fastinfoset/FastInfoset/1.2.15/FastInfoset-1.2.15-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: javax.activation:javax.activation-api:1.2.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: javax.persistence:javax.persistence-api:2.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/persistence/javax.persistence-api/2.2/javax.persistence-api-2.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/persistence/javax.persistence-api/2.2/javax.persistence-api-2.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/persistence/javax.persistence-api/2.2/javax.persistence-api-2.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: javax.xml.bind:jaxb-api:2.3.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: junit:junit:4.12">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: log4j:log4j:1.2.17">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/log4j/log4j/1.2.17/log4j-1.2.17.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/log4j/log4j/1.2.17/log4j-1.2.17-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/log4j/log4j/1.2.17/log4j-1.2.17-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: net.bytebuddy:byte-buddy:1.10.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy/1.10.2/byte-buddy-1.10.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy/1.10.2/byte-buddy-1.10.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy/1.10.2/byte-buddy-1.10.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: net.bytebuddy:byte-buddy-agent:1.8.15">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.8.15/byte-buddy-agent-1.8.15.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.8.15/byte-buddy-agent-1.8.15-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.8.15/byte-buddy-agent-1.8.15-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.apache.commons:commons-lang3:3.8.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.apache.maven.surefire:surefire-logger-api:2.21.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/surefire/surefire-logger-api/2.21.0/surefire-logger-api-2.21.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/surefire/surefire-logger-api/2.21.0/surefire-logger-api-2.21.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/surefire/surefire-logger-api/2.21.0/surefire-logger-api-2.21.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.apiguardian:apiguardian-api:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.dom4j:dom4j:2.1.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/dom4j/dom4j/2.1.1/dom4j-2.1.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/dom4j/dom4j/2.1.1/dom4j-2.1.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/dom4j/dom4j/2.1.1/dom4j-2.1.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.geolatte:geolatte-geom:1.4.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/geolatte/geolatte-geom/1.4.0/geolatte-geom-1.4.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/geolatte/geolatte-geom/1.4.0/geolatte-geom-1.4.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/geolatte/geolatte-geom/1.4.0/geolatte-geom-1.4.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.glassfish.jaxb:jaxb-runtime:2.3.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jaxb/jaxb-runtime/2.3.1/jaxb-runtime-2.3.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jaxb/jaxb-runtime/2.3.1/jaxb-runtime-2.3.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jaxb/jaxb-runtime/2.3.1/jaxb-runtime-2.3.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.glassfish.jaxb:txw2:2.3.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jaxb/txw2/2.3.1/txw2-2.3.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jaxb/txw2/2.3.1/txw2-2.3.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jaxb/txw2/2.3.1/txw2-2.3.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.hamcrest:hamcrest-all:1.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.hamcrest:hamcrest-core:1.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.hamcrest:hamcrest-library:1.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.hibernate.common:hibernate-commons-annotations:5.1.0.Final">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hibernate/common/hibernate-commons-annotations/5.1.0.Final/hibernate-commons-annotations-5.1.0.Final.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hibernate/common/hibernate-commons-annotations/5.1.0.Final/hibernate-commons-annotations-5.1.0.Final-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hibernate/common/hibernate-commons-annotations/5.1.0.Final/hibernate-commons-annotations-5.1.0.Final-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.hibernate:hibernate-core:5.4.7.Final">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hibernate/hibernate-core/5.4.7.Final/hibernate-core-5.4.7.Final.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hibernate/hibernate-core/5.4.7.Final/hibernate-core-5.4.7.Final-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hibernate/hibernate-core/5.4.7.Final/hibernate-core-5.4.7.Final-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.hibernate:hibernate-spatial:5.4.7.Final">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hibernate/hibernate-spatial/5.4.7.Final/hibernate-spatial-5.4.7.Final.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hibernate/hibernate-spatial/5.4.7.Final/hibernate-spatial-5.4.7.Final-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hibernate/hibernate-spatial/5.4.7.Final/hibernate-spatial-5.4.7.Final-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.hibernate:hibernate-testing:5.4.7.Final">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hibernate/hibernate-testing/5.4.7.Final/hibernate-testing-5.4.7.Final.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hibernate/hibernate-testing/5.4.7.Final/hibernate-testing-5.4.7.Final-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hibernate/hibernate-testing/5.4.7.Final/hibernate-testing-5.4.7.Final-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.javassist:javassist:3.24.0-GA">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.24.0-GA/javassist-3.24.0-GA.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.24.0-GA/javassist-3.24.0-GA-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.24.0-GA/javassist-3.24.0-GA-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.jboss.byteman:byteman:4.0.8">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/byteman/byteman/4.0.8/byteman-4.0.8.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/byteman/byteman/4.0.8/byteman-4.0.8-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/byteman/byteman/4.0.8/byteman-4.0.8-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.jboss.byteman:byteman-bmunit:4.0.8">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/byteman/byteman-bmunit/4.0.8/byteman-bmunit-4.0.8.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/byteman/byteman-bmunit/4.0.8/byteman-bmunit-4.0.8-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/byteman/byteman-bmunit/4.0.8/byteman-bmunit-4.0.8-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.jboss.byteman:byteman-install:4.0.8">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/byteman/byteman-install/4.0.8/byteman-install-4.0.8.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/byteman/byteman-install/4.0.8/byteman-install-4.0.8-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/byteman/byteman-install/4.0.8/byteman-install-4.0.8-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.jboss.byteman:byteman-submit:4.0.8">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/byteman/byteman-submit/4.0.8/byteman-submit-4.0.8.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/byteman/byteman-submit/4.0.8/byteman-submit-4.0.8-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/byteman/byteman-submit/4.0.8/byteman-submit-4.0.8-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.jboss:jandex:2.0.5.Final">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/jandex/2.0.5.Final/jandex-2.0.5.Final.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/jandex/2.0.5.Final/jandex-2.0.5.Final-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/jandex/2.0.5.Final/jandex-2.0.5.Final-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.jboss.jbossts:jbossjta:4.16.4.Final">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/jbossts/jbossjta/4.16.4.Final/jbossjta-4.16.4.Final.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/jbossts/jbossjta/4.16.4.Final/jbossjta-4.16.4.Final-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/jbossts/jbossjta/4.16.4.Final/jbossjta-4.16.4.Final-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.1.1.Final">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.1.1.Final/jboss-transaction-api_1.2_spec-1.1.1.Final.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.1.1.Final/jboss-transaction-api_1.2_spec-1.1.1.Final-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.1.1.Final/jboss-transaction-api_1.2_spec-1.1.1.Final-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.junit.jupiter:junit-jupiter-api:5.2.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.2.0/junit-jupiter-api-5.2.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.2.0/junit-jupiter-api-5.2.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.2.0/junit-jupiter-api-5.2.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.junit.jupiter:junit-jupiter-engine:5.2.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.2.0/junit-jupiter-engine-5.2.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.2.0/junit-jupiter-engine-5.2.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.2.0/junit-jupiter-engine-5.2.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.junit.jupiter:junit-jupiter-params:5.2.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.2.0/junit-jupiter-params-5.2.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.2.0/junit-jupiter-params-5.2.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.2.0/junit-jupiter-params-5.2.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.junit.platform:junit-platform-commons:1.2.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.2.0/junit-platform-commons-1.2.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.2.0/junit-platform-commons-1.2.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.2.0/junit-platform-commons-1.2.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.junit.platform:junit-platform-engine:1.2.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.2.0/junit-platform-engine-1.2.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.2.0/junit-platform-engine-1.2.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.2.0/junit-platform-engine-1.2.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.jvnet.staxex:stax-ex:1.8">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jvnet/staxex/stax-ex/1.8/stax-ex-1.8.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jvnet/staxex/stax-ex/1.8/stax-ex-1.8-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jvnet/staxex/stax-ex/1.8/stax-ex-1.8-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.locationtech.jts:jts-core:1.16.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/locationtech/jts/jts-core/1.16.0/jts-core-1.16.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/locationtech/jts/jts-core/1.16.0/jts-core-1.16.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/locationtech/jts/jts-core/1.16.0/jts-core-1.16.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.mockito:mockito-core:2.21.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/2.21.0/mockito-core-2.21.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/2.21.0/mockito-core-2.21.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/2.21.0/mockito-core-2.21.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.objenesis:objenesis:2.6">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/2.6/objenesis-2.6.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/2.6/objenesis-2.6-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/2.6/objenesis-2.6-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.opentest4j:opentest4j:1.1.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.1.0/opentest4j-1.1.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.1.0/opentest4j-1.1.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.1.0/opentest4j-1.1.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.postgresql:postgresql:42.2.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/postgresql/postgresql/42.2.2/postgresql-42.2.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/postgresql/postgresql/42.2.2/postgresql-42.2.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/postgresql/postgresql/42.2.2/postgresql-42.2.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.slf4j:jcl-over-slf4j:1.7.21">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/jcl-over-slf4j/1.7.21/jcl-over-slf4j-1.7.21.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/jcl-over-slf4j/1.7.21/jcl-over-slf4j-1.7.21-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/jcl-over-slf4j/1.7.21/jcl-over-slf4j-1.7.21-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.slf4j:slf4j-api:1.7.21">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||
</project>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -1,10 +0,0 @@
|
||||
## Hibernate Annotations
|
||||
|
||||
This module contains articles about Annotations used in Hibernate.
|
||||
|
||||
### Relevant Articles:
|
||||
- [Custom Types in Hibernate and the @Type Annotation](https://www.baeldung.com/hibernate-custom-types)
|
||||
- [@JoinColumn Annotation Explained](https://www.baeldung.com/jpa-join-column)
|
||||
- [Difference Between @JoinColumn and mappedBy](https://www.baeldung.com/jpa-joincolumn-vs-mappedby)
|
||||
- [Hibernate One to Many Annotation Tutorial](https://www.baeldung.com/hibernate-one-to-many)
|
||||
- [Hibernate @WhereJoinTable Annotation](https://www.baeldung.com/hibernate-wherejointable)
|
@ -1,67 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<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>
|
||||
<artifactId>hibernate-annotations</artifactId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
<name>hibernate-annotations</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Hibernate tutorial illustrating the use of named parameters</description>
|
||||
|
||||
<parent>
|
||||
<groupId>com.ossez</groupId>
|
||||
<artifactId>persistence-modules</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>${hibernate-core.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>${h2.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons.lang3.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-testing</artifactId>
|
||||
<version>${hibernate-core.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-spatial</artifactId>
|
||||
<version>${hibernate-core.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>geodb-repo</id>
|
||||
<name>GeoDB repository</name>
|
||||
<url>http://repo.boundlessgeo.com/main/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<properties>
|
||||
<hibernate-core.version>5.4.24.Final</hibernate-core.version>
|
||||
<commons-lang3.version>3.8.1</commons-lang3.version>
|
||||
<maven.deploy.skip>true</maven.deploy.skip>
|
||||
<spring-boot.version>2.1.7.RELEASE</spring-boot.version>
|
||||
<hibernate.core.version>5.4.7.Final</hibernate.core.version>
|
||||
<commons.lang3.version>3.8.1</commons.lang3.version>
|
||||
<geodb.version>0.9</geodb.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
@ -1,73 +0,0 @@
|
||||
package com.baeldung.hibernate;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.boot.MetadataSources;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
|
||||
import com.baeldung.hibernate.joincolumn.Email;
|
||||
import com.baeldung.hibernate.joincolumn.Office;
|
||||
import com.baeldung.hibernate.joincolumn.OfficeAddress;
|
||||
|
||||
public class HibernateUtil {
|
||||
private static String PROPERTY_FILE_NAME;
|
||||
|
||||
public static SessionFactory getSessionFactory() throws IOException {
|
||||
return getSessionFactory(null);
|
||||
}
|
||||
|
||||
public static SessionFactory getSessionFactory(String propertyFileName) throws IOException {
|
||||
PROPERTY_FILE_NAME = propertyFileName;
|
||||
ServiceRegistry serviceRegistry = configureServiceRegistry();
|
||||
return makeSessionFactory(serviceRegistry);
|
||||
}
|
||||
|
||||
public static SessionFactory getSessionFactoryByProperties(Properties properties) throws IOException {
|
||||
ServiceRegistry serviceRegistry = configureServiceRegistry(properties);
|
||||
return makeSessionFactory(serviceRegistry);
|
||||
}
|
||||
|
||||
private static SessionFactory makeSessionFactory(ServiceRegistry serviceRegistry) {
|
||||
MetadataSources metadataSources = new MetadataSources(serviceRegistry);
|
||||
|
||||
metadataSources.addPackage("com.baeldung.hibernate.pojo");
|
||||
metadataSources.addAnnotatedClass(com.baeldung.hibernate.joincolumn.OfficialEmployee.class);
|
||||
metadataSources.addAnnotatedClass(Email.class);
|
||||
metadataSources.addAnnotatedClass(Office.class);
|
||||
metadataSources.addAnnotatedClass(OfficeAddress.class);
|
||||
|
||||
Metadata metadata = metadataSources.getMetadataBuilder()
|
||||
.build();
|
||||
|
||||
return metadata.getSessionFactoryBuilder()
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
private static ServiceRegistry configureServiceRegistry() throws IOException {
|
||||
return configureServiceRegistry(getProperties());
|
||||
}
|
||||
|
||||
private static ServiceRegistry configureServiceRegistry(Properties properties) throws IOException {
|
||||
return new StandardServiceRegistryBuilder().applySettings(properties)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static Properties getProperties() throws IOException {
|
||||
Properties properties = new Properties();
|
||||
URL propertiesURL = Thread.currentThread()
|
||||
.getContextClassLoader()
|
||||
.getResource(StringUtils.defaultString(PROPERTY_FILE_NAME, "hibernate.properties"));
|
||||
try (FileInputStream inputStream = new FileInputStream(propertiesURL.getFile())) {
|
||||
properties.load(inputStream);
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.baeldung.hibernate;
|
||||
|
||||
public class UnsupportedTenancyException extends Exception {
|
||||
public UnsupportedTenancyException (String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
package com.baeldung.hibernate.customtypes;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Address {
|
||||
|
||||
private String addressLine1;
|
||||
private String addressLine2;
|
||||
private String city;
|
||||
private String country;
|
||||
private int zipCode;
|
||||
|
||||
public String getAddressLine1() {
|
||||
return addressLine1;
|
||||
}
|
||||
|
||||
public String getAddressLine2() {
|
||||
return addressLine2;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public int getZipCode() {
|
||||
return zipCode;
|
||||
}
|
||||
|
||||
public void setAddressLine1(String addressLine1) {
|
||||
this.addressLine1 = addressLine1;
|
||||
}
|
||||
|
||||
public void setAddressLine2(String addressLine2) {
|
||||
this.addressLine2 = addressLine2;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public void setZipCode(int zipCode) {
|
||||
this.zipCode = zipCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Address address = (Address) o;
|
||||
return zipCode == address.zipCode &&
|
||||
Objects.equals(addressLine1, address.addressLine1) &&
|
||||
Objects.equals(addressLine2, address.addressLine2) &&
|
||||
Objects.equals(city, address.city) &&
|
||||
Objects.equals(country, address.country);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(addressLine1, addressLine2, city, country, zipCode);
|
||||
}
|
||||
}
|
@ -1,169 +0,0 @@
|
||||
package com.baeldung.hibernate.customtypes;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.type.IntegerType;
|
||||
import org.hibernate.type.StringType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.usertype.CompositeUserType;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Objects;
|
||||
|
||||
public class AddressType implements CompositeUserType {
|
||||
|
||||
@Override
|
||||
public String[] getPropertyNames() {
|
||||
return new String[]{"addressLine1", "addressLine2",
|
||||
"city", "country", "zipcode"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type[] getPropertyTypes() {
|
||||
return new Type[]{StringType.INSTANCE, StringType.INSTANCE,
|
||||
StringType.INSTANCE, StringType.INSTANCE, IntegerType.INSTANCE};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPropertyValue(Object component, int property) throws HibernateException {
|
||||
|
||||
Address empAdd = (Address) component;
|
||||
|
||||
switch (property) {
|
||||
case 0:
|
||||
return empAdd.getAddressLine1();
|
||||
case 1:
|
||||
return empAdd.getAddressLine2();
|
||||
case 2:
|
||||
return empAdd.getCity();
|
||||
case 3:
|
||||
return empAdd.getCountry();
|
||||
case 4:
|
||||
return Integer.valueOf(empAdd.getZipCode());
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(property +
|
||||
" is an invalid property index for class type " +
|
||||
component.getClass().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPropertyValue(Object component, int property, Object value) throws HibernateException {
|
||||
|
||||
Address empAdd = (Address) component;
|
||||
|
||||
switch (property) {
|
||||
case 0:
|
||||
empAdd.setAddressLine1((String) value);
|
||||
case 1:
|
||||
empAdd.setAddressLine2((String) value);
|
||||
case 2:
|
||||
empAdd.setCity((String) value);
|
||||
case 3:
|
||||
empAdd.setCountry((String) value);
|
||||
case 4:
|
||||
empAdd.setZipCode((Integer) value);
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(property +
|
||||
" is an invalid property index for class type " +
|
||||
component.getClass().getName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class returnedClass() {
|
||||
return Address.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object x, Object y) throws HibernateException {
|
||||
if (x == y)
|
||||
return true;
|
||||
|
||||
if (Objects.isNull(x) || Objects.isNull(y))
|
||||
return false;
|
||||
|
||||
return x.equals(y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode(Object x) throws HibernateException {
|
||||
return x.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
|
||||
|
||||
Address empAdd = new Address();
|
||||
empAdd.setAddressLine1(rs.getString(names[0]));
|
||||
|
||||
if (rs.wasNull())
|
||||
return null;
|
||||
|
||||
empAdd.setAddressLine2(rs.getString(names[1]));
|
||||
empAdd.setCity(rs.getString(names[2]));
|
||||
empAdd.setCountry(rs.getString(names[3]));
|
||||
empAdd.setZipCode(rs.getInt(names[4]));
|
||||
|
||||
return empAdd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
|
||||
|
||||
if (Objects.isNull(value))
|
||||
st.setNull(index, Types.VARCHAR);
|
||||
else {
|
||||
|
||||
Address empAdd = (Address) value;
|
||||
st.setString(index, empAdd.getAddressLine1());
|
||||
st.setString(index + 1, empAdd.getAddressLine2());
|
||||
st.setString(index + 2, empAdd.getCity());
|
||||
st.setString(index + 3, empAdd.getCountry());
|
||||
st.setInt(index + 4, empAdd.getZipCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object deepCopy(Object value) throws HibernateException {
|
||||
|
||||
if (Objects.isNull(value))
|
||||
return null;
|
||||
|
||||
Address oldEmpAdd = (Address) value;
|
||||
Address newEmpAdd = new Address();
|
||||
|
||||
newEmpAdd.setAddressLine1(oldEmpAdd.getAddressLine1());
|
||||
newEmpAdd.setAddressLine2(oldEmpAdd.getAddressLine2());
|
||||
newEmpAdd.setCity(oldEmpAdd.getCity());
|
||||
newEmpAdd.setCountry(oldEmpAdd.getCountry());
|
||||
newEmpAdd.setZipCode(oldEmpAdd.getZipCode());
|
||||
|
||||
return newEmpAdd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable disassemble(Object value, SharedSessionContractImplementor session) throws HibernateException {
|
||||
return (Serializable) deepCopy(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) throws HibernateException {
|
||||
return deepCopy(cached);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner) throws HibernateException {
|
||||
return original;
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package com.baeldung.hibernate.customtypes;
|
||||
|
||||
import org.hibernate.type.LocalDateType;
|
||||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.java.AbstractTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class LocalDateStringJavaDescriptor extends AbstractTypeDescriptor<LocalDate> {
|
||||
|
||||
public static final LocalDateStringJavaDescriptor INSTANCE = new LocalDateStringJavaDescriptor();
|
||||
|
||||
public LocalDateStringJavaDescriptor() {
|
||||
super(LocalDate.class, ImmutableMutabilityPlan.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(LocalDate value) {
|
||||
return LocalDateType.FORMATTER.format(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDate fromString(String string) {
|
||||
return LocalDate.from(LocalDateType.FORMATTER.parse(string));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrap(LocalDate value, Class<X> type, WrapperOptions options) {
|
||||
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
if (String.class.isAssignableFrom(type))
|
||||
return (X) LocalDateType.FORMATTER.format(value);
|
||||
|
||||
throw unknownUnwrap(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> LocalDate wrap(X value, WrapperOptions options) {
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
if(String.class.isInstance(value))
|
||||
return LocalDate.from(LocalDateType.FORMATTER.parse((CharSequence) value));
|
||||
|
||||
throw unknownWrap(value.getClass());
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.baeldung.hibernate.customtypes;
|
||||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
|
||||
import org.hibernate.type.DiscriminatorType;
|
||||
import org.hibernate.type.descriptor.java.LocalDateJavaDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class LocalDateStringType extends AbstractSingleColumnStandardBasicType<LocalDate> implements DiscriminatorType<LocalDate> {
|
||||
|
||||
public static final LocalDateStringType INSTANCE = new LocalDateStringType();
|
||||
|
||||
public LocalDateStringType() {
|
||||
super(VarcharTypeDescriptor.INSTANCE, LocalDateStringJavaDescriptor.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "LocalDateString";
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDate stringToObject(String xml) throws Exception {
|
||||
return fromString(xml);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String objectToSQLString(LocalDate value, Dialect dialect) throws Exception {
|
||||
return '\'' + toString(value) + '\'';
|
||||
}
|
||||
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
package com.baeldung.hibernate.customtypes;
|
||||
|
||||
import com.baeldung.hibernate.pojo.Phone;
|
||||
import org.hibernate.annotations.Columns;
|
||||
import org.hibernate.annotations.Parameter;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.annotations.TypeDef;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@TypeDef(name = "PhoneNumber",
|
||||
typeClass = PhoneNumberType.class,
|
||||
defaultForType = PhoneNumber.class)
|
||||
@Entity
|
||||
@Table(name = "OfficeEmployee")
|
||||
public class OfficeEmployee {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private long id;
|
||||
|
||||
@Column
|
||||
@Type(type = "LocalDateString")
|
||||
private LocalDate dateOfJoining;
|
||||
|
||||
@Columns(columns = {@Column(name = "country_code"),
|
||||
@Column(name = "city_code"),
|
||||
@Column(name = "number")})
|
||||
private PhoneNumber employeeNumber;
|
||||
|
||||
@Columns(columns = {@Column(name = "address_line_1"),
|
||||
@Column(name = "address_line_2"),
|
||||
@Column(name = "city"), @Column(name = "country"),
|
||||
@Column(name = "zip_code")})
|
||||
@Type(type = "com.baeldung.hibernate.customtypes.AddressType")
|
||||
private Address empAddress;
|
||||
|
||||
@Type(type = "com.baeldung.hibernate.customtypes.SalaryType",
|
||||
parameters = {@Parameter(name = "currency", value = "USD")})
|
||||
@Columns(columns = {@Column(name = "amount"),
|
||||
@Column(name = "currency")})
|
||||
private Salary salary;
|
||||
|
||||
public Salary getSalary() {
|
||||
return salary;
|
||||
}
|
||||
|
||||
public void setSalary(Salary salary) {
|
||||
this.salary = salary;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public LocalDate getDateOfJoining() {
|
||||
return dateOfJoining;
|
||||
}
|
||||
|
||||
public void setDateOfJoining(LocalDate dateOfJoining) {
|
||||
this.dateOfJoining = dateOfJoining;
|
||||
}
|
||||
|
||||
public PhoneNumber getEmployeeNumber() {
|
||||
return employeeNumber;
|
||||
}
|
||||
|
||||
public void setEmployeeNumber(PhoneNumber employeeNumber) {
|
||||
this.employeeNumber = employeeNumber;
|
||||
}
|
||||
|
||||
public Address getEmpAddress() {
|
||||
return empAddress;
|
||||
}
|
||||
|
||||
public void setEmpAddress(Address empAddress) {
|
||||
this.empAddress = empAddress;
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package com.baeldung.hibernate.customtypes;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public final class PhoneNumber {
|
||||
|
||||
private final int countryCode;
|
||||
private final int cityCode;
|
||||
private final int number;
|
||||
|
||||
public PhoneNumber(int countryCode, int cityCode, int number) {
|
||||
this.countryCode = countryCode;
|
||||
this.cityCode = cityCode;
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public int getCountryCode() {
|
||||
return countryCode;
|
||||
}
|
||||
|
||||
public int getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public int getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
PhoneNumber that = (PhoneNumber) o;
|
||||
return countryCode == that.countryCode &&
|
||||
cityCode == that.cityCode &&
|
||||
number == that.number;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(countryCode, cityCode, number);
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
package com.baeldung.hibernate.customtypes;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class PhoneNumberType implements UserType {
|
||||
@Override
|
||||
public int[] sqlTypes() {
|
||||
return new int[]{Types.INTEGER, Types.INTEGER, Types.INTEGER};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class returnedClass() {
|
||||
return PhoneNumber.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object x, Object y) throws HibernateException {
|
||||
if (x == y)
|
||||
return true;
|
||||
if (Objects.isNull(x) || Objects.isNull(y))
|
||||
return false;
|
||||
|
||||
return x.equals(y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode(Object x) throws HibernateException {
|
||||
return x.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
|
||||
int countryCode = rs.getInt(names[0]);
|
||||
|
||||
if (rs.wasNull())
|
||||
return null;
|
||||
|
||||
int cityCode = rs.getInt(names[1]);
|
||||
int number = rs.getInt(names[2]);
|
||||
PhoneNumber employeeNumber = new PhoneNumber(countryCode, cityCode, number);
|
||||
|
||||
return employeeNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
|
||||
|
||||
if (Objects.isNull(value)) {
|
||||
st.setNull(index, Types.INTEGER);
|
||||
} else {
|
||||
PhoneNumber employeeNumber = (PhoneNumber) value;
|
||||
st.setInt(index,employeeNumber.getCountryCode());
|
||||
st.setInt(index+1,employeeNumber.getCityCode());
|
||||
st.setInt(index+2,employeeNumber.getNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object deepCopy(Object value) throws HibernateException {
|
||||
if (Objects.isNull(value))
|
||||
return null;
|
||||
|
||||
PhoneNumber empNumber = (PhoneNumber) value;
|
||||
PhoneNumber newEmpNumber = new PhoneNumber(empNumber.getCountryCode(),empNumber.getCityCode(),empNumber.getNumber());
|
||||
|
||||
return newEmpNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable disassemble(Object value) throws HibernateException {
|
||||
return (Serializable) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object assemble(Serializable cached, Object owner) throws HibernateException {
|
||||
return cached;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object replace(Object original, Object target, Object owner) throws HibernateException {
|
||||
return original;
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package com.baeldung.hibernate.customtypes;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Salary {
|
||||
|
||||
private Long amount;
|
||||
private String currency;
|
||||
|
||||
public Long getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(Long amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public String getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
public void setCurrency(String currency) {
|
||||
this.currency = currency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Salary salary = (Salary) o;
|
||||
return Objects.equals(amount, salary.amount) &&
|
||||
Objects.equals(currency, salary.currency);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(amount, currency);
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package com.baeldung.hibernate.customtypes;
|
||||
|
||||
public class SalaryCurrencyConvertor {
|
||||
|
||||
public static Long convert(Long amount, String oldCurr, String newCurr){
|
||||
if (newCurr.equalsIgnoreCase(oldCurr))
|
||||
return amount;
|
||||
|
||||
return convertTo();
|
||||
}
|
||||
|
||||
private static Long convertTo() {
|
||||
return 10L;
|
||||
}
|
||||
}
|
@ -1,161 +0,0 @@
|
||||
package com.baeldung.hibernate.customtypes;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.type.LongType;
|
||||
import org.hibernate.type.StringType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.usertype.CompositeUserType;
|
||||
import org.hibernate.usertype.DynamicParameterizedType;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
|
||||
public class SalaryType implements CompositeUserType, DynamicParameterizedType {
|
||||
|
||||
private String localCurrency;
|
||||
|
||||
@Override
|
||||
public String[] getPropertyNames() {
|
||||
return new String[]{"amount", "currency"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type[] getPropertyTypes() {
|
||||
return new Type[]{LongType.INSTANCE, StringType.INSTANCE};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPropertyValue(Object component, int property) throws HibernateException {
|
||||
|
||||
Salary salary = (Salary) component;
|
||||
|
||||
switch (property) {
|
||||
case 0:
|
||||
return salary.getAmount();
|
||||
case 1:
|
||||
return salary.getCurrency();
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(property +
|
||||
" is an invalid property index for class type " +
|
||||
component.getClass().getName());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPropertyValue(Object component, int property, Object value) throws HibernateException {
|
||||
|
||||
Salary salary = (Salary) component;
|
||||
|
||||
switch (property) {
|
||||
case 0:
|
||||
salary.setAmount((Long) value);
|
||||
case 1:
|
||||
salary.setCurrency((String) value);
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(property +
|
||||
" is an invalid property index for class type " +
|
||||
component.getClass().getName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class returnedClass() {
|
||||
return Salary.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object x, Object y) throws HibernateException {
|
||||
|
||||
if (x == y)
|
||||
return true;
|
||||
|
||||
if (Objects.isNull(x) || Objects.isNull(y))
|
||||
return false;
|
||||
|
||||
return x.equals(y);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode(Object x) throws HibernateException {
|
||||
return x.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
|
||||
|
||||
Salary salary = new Salary();
|
||||
salary.setAmount(rs.getLong(names[0]));
|
||||
|
||||
if (rs.wasNull())
|
||||
return null;
|
||||
|
||||
salary.setCurrency(rs.getString(names[1]));
|
||||
|
||||
return salary;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
|
||||
|
||||
|
||||
if (Objects.isNull(value))
|
||||
st.setNull(index, Types.BIGINT);
|
||||
else {
|
||||
|
||||
Salary salary = (Salary) value;
|
||||
st.setLong(index, SalaryCurrencyConvertor.convert(salary.getAmount(),
|
||||
salary.getCurrency(), localCurrency));
|
||||
st.setString(index + 1, salary.getCurrency());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object deepCopy(Object value) throws HibernateException {
|
||||
|
||||
if (Objects.isNull(value))
|
||||
return null;
|
||||
|
||||
Salary oldSal = (Salary) value;
|
||||
Salary newSal = new Salary();
|
||||
|
||||
newSal.setAmount(oldSal.getAmount());
|
||||
newSal.setCurrency(oldSal.getCurrency());
|
||||
|
||||
return newSal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable disassemble(Object value, SharedSessionContractImplementor session) throws HibernateException {
|
||||
return (Serializable) deepCopy(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) throws HibernateException {
|
||||
return deepCopy(cached);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner) throws HibernateException {
|
||||
return original;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParameterValues(Properties parameters) {
|
||||
this.localCurrency = parameters.getProperty("currency");
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package com.baeldung.hibernate.joincolumn;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class Email {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String address;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "employee_id")
|
||||
private OfficialEmployee employee;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public OfficialEmployee getEmployee() {
|
||||
return employee;
|
||||
}
|
||||
|
||||
public void setEmployee(OfficialEmployee employee) {
|
||||
this.employee = employee;
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package com.baeldung.hibernate.joincolumn;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinColumns;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class Office {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumns({
|
||||
@JoinColumn(name="ADDR_ID", referencedColumnName="ID"),
|
||||
@JoinColumn(name="ADDR_ZIP", referencedColumnName="ZIP")
|
||||
})
|
||||
private OfficeAddress address;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public OfficeAddress getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(OfficeAddress address) {
|
||||
this.address = address;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.baeldung.hibernate.joincolumn;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class OfficeAddress {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "ZIP")
|
||||
private String zipCode;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getZipCode() {
|
||||
return zipCode;
|
||||
}
|
||||
|
||||
public void setZipCode(String zipCode) {
|
||||
this.zipCode = zipCode;
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package com.baeldung.hibernate.joincolumn;
|
||||
|
||||
import java.util.List;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
@Entity
|
||||
public class OfficialEmployee {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "employee")
|
||||
private List<Email> emails;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public List<Email> getEmails() {
|
||||
return emails;
|
||||
}
|
||||
|
||||
public void setEmails(List<Email> emails) {
|
||||
this.emails = emails;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.baeldung.hibernate.oneToMany.config;
|
||||
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.boot.MetadataSources;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
|
||||
public class HibernateAnnotationUtil {
|
||||
|
||||
private static SessionFactory sessionFactory;
|
||||
|
||||
private static SessionFactory buildSessionFactory() {
|
||||
try {
|
||||
// Create the SessionFactory from hibernate-annotation.cfg.xml
|
||||
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().configure("hibernate-annotation.cfg.xml").build();
|
||||
Metadata metadata = new MetadataSources(serviceRegistry).getMetadataBuilder().build();
|
||||
SessionFactory sessionFactory = metadata.getSessionFactoryBuilder().build();
|
||||
|
||||
return sessionFactory;
|
||||
|
||||
} catch (Throwable ex) {
|
||||
System.err.println("Initial SessionFactory creation failed." + ex);
|
||||
ex.printStackTrace();
|
||||
throw new ExceptionInInitializerError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static SessionFactory getSessionFactory() {
|
||||
if (sessionFactory == null)
|
||||
sessionFactory = buildSessionFactory();
|
||||
return sessionFactory;
|
||||
}
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
package com.baeldung.hibernate.oneToMany.main;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.Transaction;
|
||||
|
||||
import com.baeldung.hibernate.oneToMany.config.HibernateAnnotationUtil;
|
||||
import com.baeldung.hibernate.oneToMany.model.Cart;
|
||||
import com.baeldung.hibernate.oneToMany.model.Items;
|
||||
import com.baeldung.hibernate.oneToMany.model.ItemsOIO;
|
||||
|
||||
public class HibernateManyisOwningSide {
|
||||
public static void main(String[] args) {
|
||||
|
||||
Cart cart = new Cart();
|
||||
Cart cart2 = new Cart();
|
||||
|
||||
Items item1 = new Items(cart);
|
||||
Items item2 = new Items(cart2);
|
||||
Set<Items> itemsSet = new HashSet<Items>();
|
||||
itemsSet.add(item1);
|
||||
itemsSet.add(item2);
|
||||
|
||||
cart.setItems(itemsSet);
|
||||
|
||||
|
||||
|
||||
SessionFactory sessionFactory = null;
|
||||
Session session = null;
|
||||
Transaction tx = null;
|
||||
try {
|
||||
// Get Session
|
||||
sessionFactory = HibernateAnnotationUtil.getSessionFactory();
|
||||
session = sessionFactory.getCurrentSession();
|
||||
System.out.println("Session created");
|
||||
// start transaction
|
||||
tx = session.beginTransaction();
|
||||
// Save the Model object
|
||||
session.save(cart);
|
||||
session.save(cart2);
|
||||
session.save(item1);
|
||||
session.save(item2);
|
||||
// Commit transaction
|
||||
tx.commit();
|
||||
session = sessionFactory.getCurrentSession();
|
||||
tx = session.beginTransaction();
|
||||
|
||||
item1 = (Items) session.get(Items.class, new Long(1));
|
||||
item2 = (Items) session.get(Items.class, new Long(2));
|
||||
tx.commit();
|
||||
|
||||
|
||||
System.out.println("item1 ID=" + item1.getId() + ", Foreign Key CartOIO ID=" + item1.getCart()
|
||||
.getId());
|
||||
System.out.println("item2 ID=" + item2.getId() + ", Foreign Key CartOIO ID=" + item2.getCart()
|
||||
.getId());
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("Exception occured. " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (!sessionFactory.isClosed()) {
|
||||
System.out.println("Closing SessionFactory");
|
||||
sessionFactory.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
package com.baeldung.hibernate.oneToMany.main;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.Transaction;
|
||||
|
||||
import com.baeldung.hibernate.oneToMany.config.HibernateAnnotationUtil;
|
||||
import com.baeldung.hibernate.oneToMany.model.Cart;
|
||||
import com.baeldung.hibernate.oneToMany.model.Items;
|
||||
|
||||
public class HibernateOneToManyAnnotationMain {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Cart cart = new Cart();
|
||||
|
||||
Items item1 = new Items(cart);
|
||||
Items item2 = new Items(cart);
|
||||
Set<Items> itemsSet = new HashSet<Items>();
|
||||
itemsSet.add(item1);
|
||||
itemsSet.add(item2);
|
||||
|
||||
cart.setItems(itemsSet);
|
||||
|
||||
|
||||
SessionFactory sessionFactory = null;
|
||||
Session session = null;
|
||||
Transaction tx = null;
|
||||
try {
|
||||
// Get Session
|
||||
sessionFactory = HibernateAnnotationUtil.getSessionFactory();
|
||||
session = sessionFactory.getCurrentSession();
|
||||
System.out.println("Session created");
|
||||
// start transaction
|
||||
tx = session.beginTransaction();
|
||||
// Save the Model object
|
||||
session.save(cart);
|
||||
session.save(item1);
|
||||
session.save(item2);
|
||||
// Commit transaction
|
||||
tx.commit();
|
||||
System.out.println("Cart ID=" + cart.getId());
|
||||
System.out.println("item1 ID=" + item1.getId() + ", Foreign Key Cart ID=" + item1.getCart().getId());
|
||||
System.out.println("item2 ID=" + item2.getId() + ", Foreign Key Cart ID=" + item1.getCart().getId());
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("Exception occured. " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (!sessionFactory.isClosed()) {
|
||||
System.out.println("Closing SessionFactory");
|
||||
sessionFactory.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
package com.baeldung.hibernate.oneToMany.main;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.Transaction;
|
||||
|
||||
import com.baeldung.hibernate.oneToMany.config.HibernateAnnotationUtil;
|
||||
import com.baeldung.hibernate.oneToMany.model.CartOIO;
|
||||
import com.baeldung.hibernate.oneToMany.model.ItemsOIO;
|
||||
|
||||
public class HibernateOneisOwningSide {
|
||||
public static void main(String[] args) {
|
||||
|
||||
CartOIO cart = new CartOIO();
|
||||
CartOIO cart2 = new CartOIO();
|
||||
|
||||
ItemsOIO item1 = new ItemsOIO(cart);
|
||||
ItemsOIO item2 = new ItemsOIO(cart2);
|
||||
Set<ItemsOIO> itemsSet = new HashSet<ItemsOIO>();
|
||||
itemsSet.add(item1);
|
||||
itemsSet.add(item2);
|
||||
|
||||
cart.setItems(itemsSet);
|
||||
|
||||
SessionFactory sessionFactory = null;
|
||||
Session session = null;
|
||||
Transaction tx = null;
|
||||
try {
|
||||
// Get Session
|
||||
sessionFactory = HibernateAnnotationUtil.getSessionFactory();
|
||||
session = sessionFactory.getCurrentSession();
|
||||
System.out.println("Session created");
|
||||
// start transaction
|
||||
tx = session.beginTransaction();
|
||||
// Save the Model object
|
||||
session.save(cart);
|
||||
session.save(cart2);
|
||||
session.save(item1);
|
||||
session.save(item2);
|
||||
// Commit transaction
|
||||
tx.commit();
|
||||
|
||||
session = sessionFactory.getCurrentSession();
|
||||
tx = session.beginTransaction();
|
||||
item1 = (ItemsOIO) session.get(ItemsOIO.class, new Long(1));
|
||||
item2 = (ItemsOIO) session.get(ItemsOIO.class, new Long(2));
|
||||
tx.commit();
|
||||
|
||||
System.out.println("item1 ID=" + item1.getId() + ", Foreign Key CartOIO ID=" + item1.getCartOIO()
|
||||
.getId());
|
||||
System.out.println("item2 ID=" + item2.getId() + ", Foreign Key CartOIO ID=" + item2.getCartOIO()
|
||||
.getId());
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("Exception occured. " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (!sessionFactory.isClosed()) {
|
||||
System.out.println("Closing SessionFactory");
|
||||
sessionFactory.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package com.baeldung.hibernate.oneToMany.model;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "CART")
|
||||
public class Cart {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "cart_id")
|
||||
private long id;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "cart")
|
||||
private Set<Items> items;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public Set<Items> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(Set<Items> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package com.baeldung.hibernate.oneToMany.model;
|
||||
|
||||
import java.util.Set;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "CARTOIO")
|
||||
public class CartOIO {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
|
||||
@OneToMany
|
||||
@JoinColumn(name = "cart_id") // we need to duplicate the physical information
|
||||
private Set<ItemsOIO> items;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Set<ItemsOIO> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(Set<ItemsOIO> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package com.baeldung.hibernate.oneToMany.model;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "ITEMS")
|
||||
public class Items {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private long id;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "cart_id", nullable = false)
|
||||
private Cart cart;
|
||||
|
||||
// Hibernate requires no-args constructor
|
||||
public Items() {
|
||||
}
|
||||
|
||||
public Items(Cart c) {
|
||||
this.cart = c;
|
||||
}
|
||||
|
||||
public Cart getCart() {
|
||||
return cart;
|
||||
}
|
||||
|
||||
public void setCart(Cart cart) {
|
||||
this.cart = cart;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package com.baeldung.hibernate.oneToMany.model;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "ITEMSOIO")
|
||||
public class ItemsOIO {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "cart_id", insertable = false, updatable = false)
|
||||
private CartOIO cart;
|
||||
|
||||
// Hibernate requires no-args constructor
|
||||
public ItemsOIO() {
|
||||
}
|
||||
|
||||
public ItemsOIO(CartOIO c) {
|
||||
this.cart = c;
|
||||
}
|
||||
|
||||
public CartOIO getCartOIO() {
|
||||
return cart;
|
||||
}
|
||||
|
||||
public void setCartOIO(CartOIO cart) {
|
||||
this.cart = cart;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package com.baeldung.hibernate.pojo;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Entity
|
||||
public class Phone implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
private boolean deleted;
|
||||
|
||||
private String number;
|
||||
|
||||
public Phone() {
|
||||
}
|
||||
|
||||
public Phone(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
public void setDeleted(boolean deleted) {
|
||||
this.deleted = deleted;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package com.baeldung.hibernate.wherejointable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
|
||||
@Entity(name = "e_group")
|
||||
public class Group {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
@ManyToMany(mappedBy = "groups")
|
||||
private List<User> users = new ArrayList<>();
|
||||
|
||||
public Group(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<User> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(List<User> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Group [name=" + name + "]";
|
||||
}
|
||||
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
package com.baeldung.hibernate.wherejointable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
|
||||
import org.hibernate.annotations.WhereJoinTable;
|
||||
|
||||
@Entity
|
||||
public class User {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name = "r_user_group", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "group_id"))
|
||||
private List<Group> groups = new ArrayList<>();
|
||||
|
||||
@WhereJoinTable(clause = "role='MODERATOR'")
|
||||
@ManyToMany
|
||||
@JoinTable(name = "r_user_group", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "group_id"))
|
||||
private List<Group> moderatorGroups = new ArrayList<>();
|
||||
|
||||
public User(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<Group> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
|
||||
public void setGroups(List<Group> groups) {
|
||||
this.groups = groups;
|
||||
}
|
||||
|
||||
public void setModeratorGroups(List<Group> moderatorGroups) {
|
||||
this.moderatorGroups = moderatorGroups;
|
||||
}
|
||||
|
||||
public List<Group> getModeratorGroups() {
|
||||
return moderatorGroups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User [name=" + name + "]";
|
||||
}
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package com.baeldung.hibernate.wherejointable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity(name = "r_user_group")
|
||||
public class UserGroupRelation implements Serializable {
|
||||
|
||||
@Id
|
||||
@Column(name = "user_id", insertable = false, updatable = false)
|
||||
private final Long userId;
|
||||
|
||||
@Id
|
||||
@Column(name = "group_id", insertable = false, updatable = false)
|
||||
private final Long groupId;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private final UserGroupRole role;
|
||||
|
||||
public UserGroupRelation(Long userId, Long groupId, UserGroupRole role) {
|
||||
this.userId = userId;
|
||||
this.groupId = groupId;
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package com.baeldung.hibernate.wherejointable;
|
||||
|
||||
public enum UserGroupRole {
|
||||
|
||||
MEMBER, MODERATOR
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
<?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_2_0.xsd"
|
||||
version="2.0">
|
||||
<persistence-unit name="com.baeldung.movie_catalog">
|
||||
<description>Hibernate EntityManager Demo</description>
|
||||
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||
<properties>
|
||||
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
|
||||
<property name="hibernate.hbm2ddl.auto" value="update"/>
|
||||
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
|
||||
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://127.0.0.1:3306/moviecatalog"/>
|
||||
<property name="javax.persistence.jdbc.user" value="root"/>
|
||||
<property name="javax.persistence.jdbc.password" value="root"/>
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
</persistence>
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
@ -1,90 +0,0 @@
|
||||
package com.baeldung.hibernate.customtypes;
|
||||
|
||||
import com.baeldung.hibernate.HibernateUtil;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.query.Query;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||
|
||||
public class HibernateCustomTypesManualTest {
|
||||
|
||||
@Test
|
||||
public void givenEmployee_whenSavedWithCustomTypes_thenEntityIsSaved() throws IOException {
|
||||
|
||||
final OfficeEmployee e = new OfficeEmployee();
|
||||
e.setDateOfJoining(LocalDate.now());
|
||||
|
||||
PhoneNumber number = new PhoneNumber(1, 222, 8781902);
|
||||
e.setEmployeeNumber(number);
|
||||
|
||||
Address empAdd = new Address();
|
||||
empAdd.setAddressLine1("Street");
|
||||
empAdd.setAddressLine2("Area");
|
||||
empAdd.setCity("City");
|
||||
empAdd.setCountry("Country");
|
||||
empAdd.setZipCode(100);
|
||||
|
||||
e.setEmpAddress(empAdd);
|
||||
|
||||
Salary empSalary = new Salary();
|
||||
empSalary.setAmount(1000L);
|
||||
empSalary.setCurrency("USD");
|
||||
e.setSalary(empSalary);
|
||||
|
||||
doInHibernate(this::sessionFactory, session -> {
|
||||
session.save(e);
|
||||
boolean contains = session.contains(e);
|
||||
Assert.assertTrue(contains);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEmployee_whenCustomTypeInQuery_thenReturnEntity() throws IOException {
|
||||
|
||||
final OfficeEmployee e = new OfficeEmployee();
|
||||
e.setDateOfJoining(LocalDate.now());
|
||||
|
||||
PhoneNumber number = new PhoneNumber(1, 222, 8781902);
|
||||
e.setEmployeeNumber(number);
|
||||
|
||||
Address empAdd = new Address();
|
||||
empAdd.setAddressLine1("Street");
|
||||
empAdd.setAddressLine2("Area");
|
||||
empAdd.setCity("City");
|
||||
empAdd.setCountry("Country");
|
||||
empAdd.setZipCode(100);
|
||||
e.setEmpAddress(empAdd);
|
||||
|
||||
Salary empSalary = new Salary();
|
||||
empSalary.setAmount(1000L);
|
||||
empSalary.setCurrency("USD");
|
||||
e.setSalary(empSalary);
|
||||
|
||||
doInHibernate(this::sessionFactory, session -> {
|
||||
session.save(e);
|
||||
|
||||
Query query = session.createQuery("FROM OfficeEmployee OE WHERE OE.empAddress.zipcode = :pinCode");
|
||||
query.setParameter("pinCode",100);
|
||||
int size = query.list().size();
|
||||
|
||||
Assert.assertEquals(1, size);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private SessionFactory sessionFactory() {
|
||||
try {
|
||||
return HibernateUtil.getSessionFactory("hibernate-customtypes.properties");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
package com.baeldung.hibernate.joincolumn;
|
||||
|
||||
import com.baeldung.hibernate.HibernateUtil;
|
||||
import java.io.IOException;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class JoinColumnIntegrationTest {
|
||||
|
||||
private Session session;
|
||||
private Transaction transaction;
|
||||
|
||||
@Before
|
||||
public void setUp() throws IOException {
|
||||
session = HibernateUtil.getSessionFactory("hibernate-spatial.properties")
|
||||
.openSession();
|
||||
transaction = session.beginTransaction();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
transaction.rollback();
|
||||
session.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenOfficeEntity_setAddress_shouldPersist() {
|
||||
Office office = new Office();
|
||||
|
||||
OfficeAddress address = new OfficeAddress();
|
||||
address.setZipCode("11-111");
|
||||
office.setAddress(address);
|
||||
|
||||
session.save(office);
|
||||
session.flush();
|
||||
session.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEmployeeEntity_setEmails_shouldPersist() {
|
||||
OfficialEmployee employee = new OfficialEmployee();
|
||||
|
||||
Email email = new Email();
|
||||
email.setAddress("example@email.com");
|
||||
email.setEmployee(employee);
|
||||
|
||||
session.save(employee);
|
||||
session.flush();
|
||||
session.clear();
|
||||
}
|
||||
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
package com.baeldung.hibernate.oneToMany.main;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.baeldung.hibernate.oneToMany.model.Cart;
|
||||
import com.baeldung.hibernate.oneToMany.model.Items;
|
||||
|
||||
public class HibernateOneToManyAnnotationMainIntegrationTest {
|
||||
|
||||
private static SessionFactory sessionFactory;
|
||||
|
||||
private Session session;
|
||||
|
||||
public HibernateOneToManyAnnotationMainIntegrationTest() {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeTests() {
|
||||
Configuration configuration = new Configuration().addAnnotatedClass(Cart.class).addAnnotatedClass(Items.class)
|
||||
.setProperty("hibernate.dialect", H2Dialect.class.getName())
|
||||
.setProperty("hibernate.connection.driver_class", org.h2.Driver.class.getName())
|
||||
.setProperty("hibernate.connection.url", "jdbc:h2:mem:test")
|
||||
.setProperty("hibernate.connection.username", "sa").setProperty("hibernate.connection.password", "")
|
||||
.setProperty("hibernate.hbm2ddl.auto", "update");
|
||||
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
|
||||
.applySettings(configuration.getProperties()).build();
|
||||
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
session = sessionFactory.openSession();
|
||||
session.beginTransaction();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenSession_checkIfDatabaseIsEmpty() {
|
||||
Cart cart = (Cart) session.get(Cart.class, new Long(1));
|
||||
assertNull(cart);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenSession_checkIfDatabaseIsPopulated_afterCommit() {
|
||||
Cart cart = new Cart();
|
||||
Set<Items> cartItems = new HashSet<>();
|
||||
cartItems = cart.getItems();
|
||||
Assert.assertNull(cartItems);
|
||||
Items item1 = new Items();
|
||||
item1.setCart(cart);
|
||||
assertNotNull(item1);
|
||||
Set<Items> itemsSet = new HashSet<Items>();
|
||||
itemsSet.add(item1);
|
||||
assertNotNull(itemsSet);
|
||||
cart.setItems(itemsSet);
|
||||
assertNotNull(cart);
|
||||
session.persist(cart);
|
||||
session.getTransaction().commit();
|
||||
session.close();
|
||||
|
||||
session = sessionFactory.openSession();
|
||||
session.beginTransaction();
|
||||
cart = (Cart) session.get(Cart.class, new Long(1));
|
||||
assertNotNull(cart);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
session.getTransaction().commit();
|
||||
session.close();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterTests() {
|
||||
sessionFactory.close();
|
||||
}
|
||||
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
package com.baeldung.hibernate.wherejointable;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class HibernateWhereJoinTableIntegrationTest {
|
||||
|
||||
private static SessionFactory sessionFactory;
|
||||
|
||||
private Session session;
|
||||
|
||||
/**
|
||||
* Test data
|
||||
*/
|
||||
private User user1;
|
||||
private User user2;
|
||||
private User user3;
|
||||
private Group group1;
|
||||
private Group group2;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeTests() {
|
||||
Configuration configuration = new Configuration().addAnnotatedClass(User.class)
|
||||
.addAnnotatedClass(Group.class)
|
||||
.addAnnotatedClass(UserGroupRelation.class)
|
||||
.setProperty("hibernate.dialect", H2Dialect.class.getName())
|
||||
.setProperty("hibernate.connection.driver_class", org.h2.Driver.class.getName())
|
||||
.setProperty("hibernate.connection.url", "jdbc:h2:mem:test")
|
||||
.setProperty("hibernate.connection.username", "sa")
|
||||
.setProperty("hibernate.connection.password", "")
|
||||
.setProperty("hibernate.hbm2ddl.auto", "update");
|
||||
|
||||
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
|
||||
.applySettings(configuration.getProperties())
|
||||
.build();
|
||||
|
||||
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
session = sessionFactory.openSession();
|
||||
session.beginTransaction();
|
||||
|
||||
user1 = new User("user1");
|
||||
user2 = new User("user2");
|
||||
user3 = new User("user3");
|
||||
|
||||
group1 = new Group("group1");
|
||||
group2 = new Group("group2");
|
||||
|
||||
session.save(group1);
|
||||
session.save(group2);
|
||||
|
||||
session.save(user1);
|
||||
session.save(user2);
|
||||
session.save(user3);
|
||||
|
||||
saveRelation(user1, group1, UserGroupRole.MODERATOR);
|
||||
saveRelation(user2, group1, UserGroupRole.MODERATOR);
|
||||
saveRelation(user3, group1, UserGroupRole.MEMBER);
|
||||
|
||||
saveRelation(user1, group2, UserGroupRole.MEMBER);
|
||||
saveRelation(user2, group2, UserGroupRole.MODERATOR);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
session.getTransaction().commit();
|
||||
session.close();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterTests() {
|
||||
sessionFactory.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenUser1_getGroups_returnsAllGroups() {
|
||||
List<Group> groups = user1.getGroups();
|
||||
assertEquals(2, groups.size());
|
||||
|
||||
assertTrue(groups.contains(group1));
|
||||
assertTrue(groups.contains(group2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenUser1_getModeratorGroups_returnsOnlyModeratorGroups() {
|
||||
List<Group> groups = user1.getModeratorGroups();
|
||||
assertEquals(1, groups.size());
|
||||
|
||||
assertTrue(groups.contains(group1));
|
||||
}
|
||||
|
||||
private void saveRelation(User user, Group group, UserGroupRole role) {
|
||||
UserGroupRelation relation = new UserGroupRelation(user.getId(), group.getId(), role);
|
||||
|
||||
session.save(relation);
|
||||
session.flush();
|
||||
session.refresh(user);
|
||||
session.refresh(group);
|
||||
}
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
hibernate.connection.driver_class=org.h2.Driver
|
||||
hibernate.connection.url=jdbc:h2:mem:mydb1;DB_CLOSE_DELAY=-1
|
||||
hibernate.connection.username=sa
|
||||
hibernate.connection.autocommit=true
|
||||
jdbc.password=
|
||||
|
||||
hibernate.dialect=org.hibernate.spatial.dialect.h2geodb.GeoDBDialect
|
||||
hibernate.show_sql=true
|
||||
hibernate.hbm2ddl.auto=create-drop
|
||||
|
||||
hibernate.c3p0.min_size=5
|
||||
hibernate.c3p0.max_size=20
|
||||
hibernate.c3p0.acquire_increment=5
|
||||
hibernate.c3p0.timeout=1800
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
|
||||
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
|
||||
<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
<logger name="org.hibernate">
|
||||
<level value="info" />
|
||||
</logger>
|
||||
<logger name="org.hibernate.SQL">
|
||||
<level value="debug" />
|
||||
</logger>
|
||||
<logger name="org.hibernate.type.descriptor.sql">
|
||||
<level value="trace" />
|
||||
</logger>
|
||||
<logger name="org.hibernate.stat">
|
||||
<level value="debug" />
|
||||
</logger>
|
||||
<root>
|
||||
<priority value ="info" />
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</log4j:configuration>
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="INFO">
|
||||
<Appenders>
|
||||
<Console name="console" target="SYSTEM_OUT">
|
||||
<PatternLayout
|
||||
pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n" />
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Logger name="org.hibernate" level="info"/>
|
||||
<Logger name="org.hibernate.SQL" level="debug"/>
|
||||
<Logger name="org.hibernate.type.descriptor.sql" level="trace"/>
|
||||
<Logger name="org.hibernate.stat" level="debug" />
|
||||
<Root level="info" additivity="false">
|
||||
<AppenderRef ref="console" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss} | %-5p | [%thread] %logger{5}:%L - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.hibernate" level="INFO" />
|
||||
<logger name="org.hibernate.SQL" level="DEBUG" />
|
||||
<logger name="org.hibernate.type.descriptor.sql" level="TRACE" />
|
||||
<logger name="org.hibernate.stat" level="DEBUG" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user