Added tutorials of the hibernate-release 5.2.18.Final
authorKai Moritz <kai@juplo.de>
Fri, 5 Apr 2019 09:54:06 +0000 (11:54 +0200)
committerKai Moritz <kai@juplo.de>
Fri, 5 Apr 2019 13:07:38 +0000 (15:07 +0200)
* Moved the version of the tutorials from 4.3.9.Final to tutorieals-4.3.9
* This commit contains the unchanged tutorials from the 5.2.18-Release
  See: http://docs.jboss.org/hibernate/orm/5.2/quickstart/html_single/#preface
  Download: http://docs.jboss.org/hibernate/orm/5.2/quickstart/html_single/hibernate-tutorials.zip

208 files changed:
src/it/tutorials-4.3.9/annotations/pom.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/annotations/src/test/java/org/hibernate/tutorial/annotations/AnnotationsIllustrationTest.java [new file with mode: 0644]
src/it/tutorials-4.3.9/annotations/src/test/java/org/hibernate/tutorial/annotations/Event.java [new file with mode: 0644]
src/it/tutorials-4.3.9/annotations/src/test/resources/hibernate.cfg.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/basic/pom.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/basic/src/test/java/org/hibernate/tutorial/hbm/Event.hbm.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/basic/src/test/java/org/hibernate/tutorial/hbm/Event.java [new file with mode: 0644]
src/it/tutorials-4.3.9/basic/src/test/java/org/hibernate/tutorial/hbm/NativeApiIllustrationTest.java [new file with mode: 0644]
src/it/tutorials-4.3.9/basic/src/test/resources/hibernate.cfg.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/entitymanager/pom.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/entitymanager/src/test/java/org/hibernate/tutorial/em/EntityManagerIllustrationTest.java [new file with mode: 0644]
src/it/tutorials-4.3.9/entitymanager/src/test/java/org/hibernate/tutorial/em/Event.java [new file with mode: 0644]
src/it/tutorials-4.3.9/entitymanager/src/test/resources/META-INF/persistence.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/envers/pom.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/envers/src/test/java/org/hibernate/tutorial/envers/EnversIllustrationTest.java [new file with mode: 0644]
src/it/tutorials-4.3.9/envers/src/test/java/org/hibernate/tutorial/envers/Event.java [new file with mode: 0644]
src/it/tutorials-4.3.9/envers/src/test/resources/META-INF/persistence.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/managed-jpa/features.xml [new file with mode: 0755]
src/it/tutorials-4.3.9/osgi/managed-jpa/pom.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/resources/META-INF/persistence.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/features.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/pom.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/HibernateUtil.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestIntegrator.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestTypeContributor.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/resources/META-INF/persistence.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/features.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/pom.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointService.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/HibernateUtil.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestIntegrator.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestTypeContributor.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/AddCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetRevisionsCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/LoadCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/entity/DataPoint.java [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/resources/OSGI-INF/blueprint/blueprint.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/resources/ehcache.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/resources/hibernate.cfg.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/resources/pool-one.properties [new file with mode: 0644]
src/it/tutorials-4.3.9/pom.xml [new file with mode: 0644]
src/it/tutorials-4.3.9/schema-annotations.sql [new file with mode: 0644]
src/it/tutorials-4.3.9/schema-basic.sql [new file with mode: 0644]
src/it/tutorials-4.3.9/schema-entitymanager.sql [new file with mode: 0644]
src/it/tutorials-4.3.9/schema-envers.sql [new file with mode: 0644]
src/it/tutorials-4.3.9/schema-osgi-managed-jpa.sql [new file with mode: 0644]
src/it/tutorials-4.3.9/schema-osgi-unmanaged-jpa.sql [new file with mode: 0644]
src/it/tutorials-4.3.9/schema-osgi-unmanaged-native.sql [new file with mode: 0644]
src/it/tutorials-4.3.9/verify.bsh [new file with mode: 0644]
src/it/tutorials-5.2.18/annotations/pom.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/annotations/src/test/java/org/hibernate/tutorial/annotations/AnnotationsIllustrationTest.java [new file with mode: 0644]
src/it/tutorials-5.2.18/annotations/src/test/java/org/hibernate/tutorial/annotations/Event.java [new file with mode: 0644]
src/it/tutorials-5.2.18/annotations/src/test/resources/hibernate.cfg.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/basic/pom.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/basic/src/test/java/org/hibernate/tutorial/hbm/Event.hbm.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/basic/src/test/java/org/hibernate/tutorial/hbm/Event.java [new file with mode: 0644]
src/it/tutorials-5.2.18/basic/src/test/java/org/hibernate/tutorial/hbm/NativeApiIllustrationTest.java [new file with mode: 0644]
src/it/tutorials-5.2.18/basic/src/test/resources/hibernate.cfg.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/entitymanager/pom.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/entitymanager/src/test/java/org/hibernate/tutorial/em/EntityManagerIllustrationTest.java [new file with mode: 0644]
src/it/tutorials-5.2.18/entitymanager/src/test/java/org/hibernate/tutorial/em/Event.java [new file with mode: 0644]
src/it/tutorials-5.2.18/entitymanager/src/test/resources/META-INF/persistence.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/envers/pom.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/envers/src/test/java/org/hibernate/tutorial/envers/EnversIllustrationTest.java [new file with mode: 0644]
src/it/tutorials-5.2.18/envers/src/test/java/org/hibernate/tutorial/envers/Event.java [new file with mode: 0644]
src/it/tutorials-5.2.18/envers/src/test/resources/META-INF/persistence.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/datasource-h2.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/managed-jpa/features.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/managed-jpa/pom.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/resources/META-INF/persistence.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/pom.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/features.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/pom.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/HibernateUtil.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestIntegrator.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestTypeContributor.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/resources/META-INF/persistence.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/features.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/pom.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointService.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/HibernateUtil.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestIntegrator.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestTypeContributor.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/AddCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetRevisionsCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/LoadCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/entity/DataPoint.java [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/resources/OSGI-INF/blueprint/blueprint.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/resources/ehcache.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/resources/hibernate.cfg.xml [new file with mode: 0644]
src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/resources/pool-one.properties [new file with mode: 0644]
src/it/tutorials-5.2.18/pom.xml [new file with mode: 0644]
src/it/tutorials/annotations/pom.xml [deleted file]
src/it/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/AnnotationsIllustrationTest.java [deleted file]
src/it/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/Event.java [deleted file]
src/it/tutorials/annotations/src/test/resources/hibernate.cfg.xml [deleted file]
src/it/tutorials/basic/pom.xml [deleted file]
src/it/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.hbm.xml [deleted file]
src/it/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.java [deleted file]
src/it/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/NativeApiIllustrationTest.java [deleted file]
src/it/tutorials/basic/src/test/resources/hibernate.cfg.xml [deleted file]
src/it/tutorials/entitymanager/pom.xml [deleted file]
src/it/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/EntityManagerIllustrationTest.java [deleted file]
src/it/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/Event.java [deleted file]
src/it/tutorials/entitymanager/src/test/resources/META-INF/persistence.xml [deleted file]
src/it/tutorials/entitymanager/target/create.sql [deleted file]
src/it/tutorials/envers/pom.xml [deleted file]
src/it/tutorials/envers/src/test/java/org/hibernate/tutorial/envers/EnversIllustrationTest.java [deleted file]
src/it/tutorials/envers/src/test/java/org/hibernate/tutorial/envers/Event.java [deleted file]
src/it/tutorials/envers/src/test/resources/META-INF/persistence.xml [deleted file]
src/it/tutorials/osgi/managed-jpa/features.xml [deleted file]
src/it/tutorials/osgi/managed-jpa/pom.xml [deleted file]
src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java [deleted file]
src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java [deleted file]
src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java [deleted file]
src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java [deleted file]
src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java [deleted file]
src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java [deleted file]
src/it/tutorials/osgi/managed-jpa/src/main/resources/META-INF/persistence.xml [deleted file]
src/it/tutorials/osgi/managed-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/features.xml [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/pom.xml [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/HibernateUtil.java [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestIntegrator.java [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestTypeContributor.java [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/src/main/resources/META-INF/persistence.xml [deleted file]
src/it/tutorials/osgi/unmanaged-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml [deleted file]
src/it/tutorials/osgi/unmanaged-native/features.xml [deleted file]
src/it/tutorials/osgi/unmanaged-native/pom.xml [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointService.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/HibernateUtil.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestIntegrator.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestTypeContributor.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/AddCommand.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetCommand.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetRevisionsCommand.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/LoadCommand.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/entity/DataPoint.java [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/resources/OSGI-INF/blueprint/blueprint.xml [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/resources/ehcache.xml [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/resources/hibernate.cfg.xml [deleted file]
src/it/tutorials/osgi/unmanaged-native/src/main/resources/pool-one.properties [deleted file]
src/it/tutorials/pom.xml [deleted file]
src/it/tutorials/schema-annotations.sql [deleted file]
src/it/tutorials/schema-basic.sql [deleted file]
src/it/tutorials/schema-entitymanager.sql [deleted file]
src/it/tutorials/schema-envers.sql [deleted file]
src/it/tutorials/schema-osgi-managed-jpa.sql [deleted file]
src/it/tutorials/schema-osgi-unmanaged-jpa.sql [deleted file]
src/it/tutorials/schema-osgi-unmanaged-native.sql [deleted file]
src/it/tutorials/verify.bsh [deleted file]

diff --git a/src/it/tutorials-4.3.9/annotations/pom.xml b/src/it/tutorials-4.3.9/annotations/pom.xml
new file mode 100644 (file)
index 0000000..86982ad
--- /dev/null
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+  ~ indicated by the @author tags or express copyright attribution
+  ~ statements applied by the authors.  All third-party contributions are
+  ~ distributed under license by Red Hat Inc.
+  ~
+  ~ This copyrighted material is made available to anyone wishing to use, modify,
+  ~ copy, or redistribute it subject to the terms and conditions of the GNU
+  ~ Lesser General Public License, as published by the Free Software Foundation.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+  ~ for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public License
+  ~ along with this distribution; if not, write to:
+  ~ Free Software Foundation, Inc.
+  ~ 51 Franklin Street, Fifth Floor
+  ~ Boston, MA  02110-1301  USA
+  -->
+<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>
+
+    <parent>
+        <groupId>org.hibernate.tutorials</groupId>
+        <artifactId>hibernate-tutorials</artifactId>
+        <version>4.3.9.Final</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>hibernate-tutorial-annotations</artifactId>
+    <name>Hibernate Annotations Tutorial</name>
+    <description>Hibernate tutorial illustrating the use of native APIs and annotations for mapping metadata</description>
+
+    <properties>
+        <!-- Skip artifact deployment -->
+        <maven.deploy.skip>true</maven.deploy.skip>
+        <h4mp.version>@project.version@</h4mp.version>
+    </properties>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>de.juplo</groupId>
+                <artifactId>hibernate-maven-plugin</artifactId>
+                <version>${h4mp.version}</version>
+                <executions>
+                    <execution>
+                        <phase>process-test-classes</phase>
+                        <goals>
+                            <goal>create</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <scanTestClasses>true</scanTestClasses>
+                    <format>true</format>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/src/it/tutorials-4.3.9/annotations/src/test/java/org/hibernate/tutorial/annotations/AnnotationsIllustrationTest.java b/src/it/tutorials-4.3.9/annotations/src/test/java/org/hibernate/tutorial/annotations/AnnotationsIllustrationTest.java
new file mode 100644 (file)
index 0000000..c1131d2
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.annotations;
+
+import java.util.Date;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+
+/**
+ * Illustrates the use of Hibernate native APIs.  The code here is unchanged from the {@code basic} example, the
+ * only difference being the use of annotations to supply the metadata instead of Hibernate mapping files.
+ *
+ * @author Steve Ebersole
+ */
+public class AnnotationsIllustrationTest extends TestCase {
+       private SessionFactory sessionFactory;
+
+       @Override
+       protected void setUp() throws Exception {
+               // A SessionFactory is set up once for an application
+        sessionFactory = new Configuration()
+                .configure() // configures settings from hibernate.cfg.xml
+                .buildSessionFactory();
+       }
+
+       @Override
+       protected void tearDown() throws Exception {
+               if ( sessionFactory != null ) {
+                       sessionFactory.close();
+               }
+       }
+
+       @SuppressWarnings({ "unchecked" })
+       public void testBasicUsage() {
+               // create a couple of events...
+               Session session = sessionFactory.openSession();
+               session.beginTransaction();
+               session.save( new Event( "Our very first event!", new Date() ) );
+               session.save( new Event( "A follow up event", new Date() ) );
+               session.getTransaction().commit();
+               session.close();
+
+               // now lets pull events from the database and list them
+               session = sessionFactory.openSession();
+        session.beginTransaction();
+        List result = session.createQuery( "from Event" ).list();
+               for ( Event event : (List<Event>) result ) {
+                       System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
+               }
+        session.getTransaction().commit();
+        session.close();
+       }
+}
diff --git a/src/it/tutorials-4.3.9/annotations/src/test/java/org/hibernate/tutorial/annotations/Event.java b/src/it/tutorials-4.3.9/annotations/src/test/java/org/hibernate/tutorial/annotations/Event.java
new file mode 100644 (file)
index 0000000..c66349f
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.annotations;
+
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.hibernate.annotations.GenericGenerator;
+
+@Entity
+@Table( name = "EVENTS" )
+public class Event {
+    private Long id;
+
+    private String title;
+    private Date date;
+
+       public Event() {
+               // this form used by Hibernate
+       }
+
+       public Event(String title, Date date) {
+               // for application use, to create new events
+               this.title = title;
+               this.date = date;
+       }
+
+       @Id
+       @GeneratedValue(generator="increment")
+       @GenericGenerator(name="increment", strategy = "increment")
+    public Long getId() {
+               return id;
+    }
+
+    private void setId(Long id) {
+               this.id = id;
+    }
+
+       @Temporal(TemporalType.TIMESTAMP)
+       @Column(name = "EVENT_DATE")
+    public Date getDate() {
+               return date;
+    }
+
+    public void setDate(Date date) {
+               this.date = date;
+    }
+
+    public String getTitle() {
+               return title;
+    }
+
+    public void setTitle(String title) {
+               this.title = title;
+    }
+}
\ No newline at end of file
diff --git a/src/it/tutorials-4.3.9/annotations/src/test/resources/hibernate.cfg.xml b/src/it/tutorials-4.3.9/annotations/src/test/resources/hibernate.cfg.xml
new file mode 100644 (file)
index 0000000..d9ae1f5
--- /dev/null
@@ -0,0 +1,56 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+  ~ indicated by the @author tags or express copyright attribution
+  ~ statements applied by the authors.  All third-party contributions are
+  ~ distributed under license by Red Hat Inc.
+  ~
+  ~ This copyrighted material is made available to anyone wishing to use, modify,
+  ~ copy, or redistribute it subject to the terms and conditions of the GNU
+  ~ Lesser General Public License, as published by the Free Software Foundation.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+  ~ for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public License
+  ~ along with this distribution; if not, write to:
+  ~ Free Software Foundation, Inc.
+  ~ 51 Franklin Street, Fifth Floor
+  ~ Boston, MA  02110-1301  USA
+  -->
+<!DOCTYPE hibernate-configuration PUBLIC
+        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+
+    <session-factory>
+
+        <!-- Database connection settings -->
+        <property name="connection.driver_class">org.h2.Driver</property>
+        <property name="connection.url">jdbc:h2:${project.build.directory}/db/test;MVCC=TRUE</property>
+        <property name="connection.username">sa</property>
+        <property name="connection.password"></property>
+
+        <!-- JDBC connection pool (use the built-in) -->
+        <property name="connection.pool_size">1</property>
+
+        <!-- SQL dialect -->
+        <property name="dialect">org.hibernate.dialect.H2Dialect</property>
+
+        <!-- Disable the second-level cache  -->
+        <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
+
+        <!-- Echo all executed SQL to stdout -->
+        <property name="show_sql">true</property>
+
+        <!-- Names the annotated entity class -->
+        <mapping class="org.hibernate.tutorial.annotations.Event"/>
+
+    </session-factory>
+
+</hibernate-configuration>
\ No newline at end of file
diff --git a/src/it/tutorials-4.3.9/basic/pom.xml b/src/it/tutorials-4.3.9/basic/pom.xml
new file mode 100644 (file)
index 0000000..64ecf12
--- /dev/null
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+  ~ indicated by the @author tags or express copyright attribution
+  ~ statements applied by the authors.  All third-party contributions are
+  ~ distributed under license by Red Hat Inc.
+  ~
+  ~ This copyrighted material is made available to anyone wishing to use, modify,
+  ~ copy, or redistribute it subject to the terms and conditions of the GNU
+  ~ Lesser General Public License, as published by the Free Software Foundation.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+  ~ for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public License
+  ~ along with this distribution; if not, write to:
+  ~ Free Software Foundation, Inc.
+  ~ 51 Franklin Street, Fifth Floor
+  ~ Boston, MA  02110-1301  USA
+  -->
+<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>
+
+    <parent>
+        <groupId>org.hibernate.tutorials</groupId>
+        <artifactId>hibernate-tutorials</artifactId>
+        <version>4.3.9.Final</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>hibernate-tutorial-hbm</artifactId>
+    <name>Hibernate hbm.xml Tutorial</name>
+    <description>Hibernate tutorial illustrating the use of native APIs and hbm.xml for mapping metadata</description>
+
+    <properties>
+        <!-- Skip artifact deployment -->
+        <maven.deploy.skip>true</maven.deploy.skip>
+        <h4mp.version>@project.version@</h4mp.version>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>de.juplo</groupId>
+                <artifactId>hibernate-maven-plugin</artifactId>
+                <version>${h4mp.version}</version>
+                <executions>
+                    <execution>
+                        <phase>process-test-classes</phase>
+                        <goals>
+                            <goal>create</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <scanTestClasses>true</scanTestClasses>
+                    <format>true</format>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/src/it/tutorials-4.3.9/basic/src/test/java/org/hibernate/tutorial/hbm/Event.hbm.xml b/src/it/tutorials-4.3.9/basic/src/test/java/org/hibernate/tutorial/hbm/Event.hbm.xml
new file mode 100644 (file)
index 0000000..2b3de75
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+  ~ indicated by the @author tags or express copyright attribution
+  ~ statements applied by the authors.  All third-party contributions are
+  ~ distributed under license by Red Hat Inc.
+  ~
+  ~ This copyrighted material is made available to anyone wishing to use, modify,
+  ~ copy, or redistribute it subject to the terms and conditions of the GNU
+  ~ Lesser General Public License, as published by the Free Software Foundation.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+  ~ for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public License
+  ~ along with this distribution; if not, write to:
+  ~ Free Software Foundation, Inc.
+  ~ 51 Franklin Street, Fifth Floor
+  ~ Boston, MA  02110-1301  USA
+  -->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.tutorial.hbm">
+
+    <class name="Event" table="EVENTS">
+        <id name="id" column="EVENT_ID">
+            <generator class="increment"/>
+        </id>
+        <property name="date" type="timestamp" column="EVENT_DATE"/>
+        <property name="title"/>
+    </class>
+
+</hibernate-mapping>
diff --git a/src/it/tutorials-4.3.9/basic/src/test/java/org/hibernate/tutorial/hbm/Event.java b/src/it/tutorials-4.3.9/basic/src/test/java/org/hibernate/tutorial/hbm/Event.java
new file mode 100644 (file)
index 0000000..ae4c2df
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.hbm;
+
+import java.util.Date;
+
+public class Event {
+       private Long id;
+
+       private String title;
+       private Date date;
+
+       public Event() {
+               // this form used by Hibernate
+       }
+
+       public Event(String title, Date date) {
+               // for application use, to create new events
+               this.title = title;
+               this.date = date;
+       }
+
+       public Long getId() {
+               return id;
+       }
+
+       private void setId(Long id) {
+               this.id = id;
+       }
+
+       public Date getDate() {
+               return date;
+       }
+
+       public void setDate(Date date) {
+               this.date = date;
+       }
+
+       public String getTitle() {
+               return title;
+       }
+
+       public void setTitle(String title) {
+               this.title = title;
+       }
+}
\ No newline at end of file
diff --git a/src/it/tutorials-4.3.9/basic/src/test/java/org/hibernate/tutorial/hbm/NativeApiIllustrationTest.java b/src/it/tutorials-4.3.9/basic/src/test/java/org/hibernate/tutorial/hbm/NativeApiIllustrationTest.java
new file mode 100644 (file)
index 0000000..c714f70
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.hbm;
+
+import java.util.Date;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+
+/**
+ * Illustrates use of Hibernate native APIs.
+ *
+ * @author Steve Ebersole
+ */
+public class NativeApiIllustrationTest extends TestCase {
+       private SessionFactory sessionFactory;
+
+       @Override
+       protected void setUp() throws Exception {
+               // A SessionFactory is set up once for an application
+        sessionFactory = new Configuration()
+                .configure() // configures settings from hibernate.cfg.xml
+                .buildSessionFactory();
+       }
+
+       @Override
+       protected void tearDown() throws Exception {
+               if ( sessionFactory != null ) {
+                       sessionFactory.close();
+               }
+       }
+
+       public void testBasicUsage() {
+               // create a couple of events...
+               Session session = sessionFactory.openSession();
+               session.beginTransaction();
+               session.save( new Event( "Our very first event!", new Date() ) );
+               session.save( new Event( "A follow up event", new Date() ) );
+               session.getTransaction().commit();
+               session.close();
+
+               // now lets pull events from the database and list them
+               session = sessionFactory.openSession();
+        session.beginTransaction();
+        List result = session.createQuery( "from Event" ).list();
+               for ( Event event : (List<Event>) result ) {
+                       System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
+               }
+        session.getTransaction().commit();
+        session.close();
+       }
+}
diff --git a/src/it/tutorials-4.3.9/basic/src/test/resources/hibernate.cfg.xml b/src/it/tutorials-4.3.9/basic/src/test/resources/hibernate.cfg.xml
new file mode 100644 (file)
index 0000000..8144f2d
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+  ~ indicated by the @author tags or express copyright attribution
+  ~ statements applied by the authors.  All third-party contributions are
+  ~ distributed under license by Red Hat Inc.
+  ~
+  ~ This copyrighted material is made available to anyone wishing to use, modify,
+  ~ copy, or redistribute it subject to the terms and conditions of the GNU
+  ~ Lesser General Public License, as published by the Free Software Foundation.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+  ~ for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public License
+  ~ along with this distribution; if not, write to:
+  ~ Free Software Foundation, Inc.
+  ~ 51 Franklin Street, Fifth Floor
+  ~ Boston, MA  02110-1301  USA
+  -->
+<!DOCTYPE hibernate-configuration PUBLIC
+        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+
+    <session-factory>
+
+        <!-- Database connection settings -->
+        <property name="connection.driver_class">org.h2.Driver</property>
+        <property name="connection.url">jdbc:h2:${project.build.directory}/db/test;MVCC=TRUE</property>
+        <property name="connection.username">sa</property>
+        <property name="connection.password"/>
+
+        <!-- JDBC connection pool (use the built-in) -->
+        <property name="connection.pool_size">1</property>
+
+        <!-- SQL dialect -->
+        <property name="dialect">org.hibernate.dialect.H2Dialect</property>
+
+        <!-- Disable the second-level cache  -->
+        <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
+
+        <!-- Echo all executed SQL to stdout -->
+        <property name="show_sql">true</property>
+
+        <!-- Drop and re-create the database schema on startup -->
+        <property name="hbm2ddl.auto">create</property>
+
+        <mapping resource="org/hibernate/tutorial/hbm/Event.hbm.xml"/>
+
+    </session-factory>
+
+</hibernate-configuration>
\ No newline at end of file
diff --git a/src/it/tutorials-4.3.9/entitymanager/pom.xml b/src/it/tutorials-4.3.9/entitymanager/pom.xml
new file mode 100644 (file)
index 0000000..9d740a5
--- /dev/null
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+  ~ indicated by the @author tags or express copyright attribution
+  ~ statements applied by the authors.  All third-party contributions are
+  ~ distributed under license by Red Hat Inc.
+  ~
+  ~ This copyrighted material is made available to anyone wishing to use, modify,
+  ~ copy, or redistribute it subject to the terms and conditions of the GNU
+  ~ Lesser General Public License, as published by the Free Software Foundation.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+  ~ for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public License
+  ~ along with this distribution; if not, write to:
+  ~ Free Software Foundation, Inc.
+  ~ 51 Franklin Street, Fifth Floor
+  ~ Boston, MA  02110-1301  USA
+  -->
+<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>
+
+    <parent>
+        <groupId>org.hibernate.tutorials</groupId>
+        <artifactId>hibernate-tutorials</artifactId>
+        <version>4.3.9.Final</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>hibernate-tutorial-entitymanager</artifactId>
+    <name>Hibernate JPA Tutorial</name>
+    <description>Hibernate tutorial illustrating the use of JPA APIs and annotations for mapping metadata</description>
+
+    <properties>
+        <!-- Skip artifact deployment -->
+        <maven.deploy.skip>true</maven.deploy.skip>
+        <h4mp.version>@project.version@</h4mp.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-entitymanager</artifactId>
+            <version>4.3.9.Final</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>de.juplo</groupId>
+                <artifactId>hibernate-maven-plugin</artifactId>
+                <version>${h4mp.version}</version>
+                <executions>
+                    <execution>
+                        <phase>process-test-classes</phase>
+                        <goals>
+                            <goal>create</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <scanTestClasses>true</scanTestClasses>
+                    <dialect>org.hibernate.dialect.H2Dialect</dialect>
+                    <format>true</format>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/src/it/tutorials-4.3.9/entitymanager/src/test/java/org/hibernate/tutorial/em/EntityManagerIllustrationTest.java b/src/it/tutorials-4.3.9/entitymanager/src/test/java/org/hibernate/tutorial/em/EntityManagerIllustrationTest.java
new file mode 100644 (file)
index 0000000..feebd89
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.em;
+
+import java.util.Date;
+import java.util.List;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import junit.framework.TestCase;
+
+/**
+ * Illustrates basic use of Hibernate as a JPA provider.
+ *
+ * @author Steve Ebersole
+ */
+public class EntityManagerIllustrationTest extends TestCase {
+       private EntityManagerFactory entityManagerFactory;
+
+       @Override
+       protected void setUp() throws Exception {
+               // like discussed with regards to SessionFactory, an EntityManagerFactory is set up once for an application
+               //              IMPORTANT: notice how the name here matches the name we gave the persistence-unit in persistence.xml!
+               entityManagerFactory = Persistence.createEntityManagerFactory( "org.hibernate.tutorial.jpa" );
+       }
+
+       @Override
+       protected void tearDown() throws Exception {
+               entityManagerFactory.close();
+       }
+
+       public void testBasicUsage() {
+               // create a couple of events...
+               EntityManager entityManager = entityManagerFactory.createEntityManager();
+               entityManager.getTransaction().begin();
+               entityManager.persist( new Event( "Our very first event!", new Date() ) );
+               entityManager.persist( new Event( "A follow up event", new Date() ) );
+               entityManager.getTransaction().commit();
+               entityManager.close();
+
+               // now lets pull events from the database and list them
+               entityManager = entityManagerFactory.createEntityManager();
+               entityManager.getTransaction().begin();
+        List<Event> result = entityManager.createQuery( "from Event", Event.class ).getResultList();
+               for ( Event event : result ) {
+                       System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
+               }
+        entityManager.getTransaction().commit();
+        entityManager.close();
+       }
+}
diff --git a/src/it/tutorials-4.3.9/entitymanager/src/test/java/org/hibernate/tutorial/em/Event.java b/src/it/tutorials-4.3.9/entitymanager/src/test/java/org/hibernate/tutorial/em/Event.java
new file mode 100644 (file)
index 0000000..90fe414
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.em;
+
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.hibernate.annotations.GenericGenerator;
+
+@Entity
+@Table( name = "EVENTS" )
+public class Event {
+    private Long id;
+
+    private String title;
+    private Date date;
+
+       public Event() {
+               // this form used by Hibernate
+       }
+
+       public Event(String title, Date date) {
+               // for application use, to create new events
+               this.title = title;
+               this.date = date;
+       }
+
+       @Id
+       @GeneratedValue(generator="increment")
+       @GenericGenerator(name="increment", strategy = "increment")
+    public Long getId() {
+               return id;
+    }
+
+    private void setId(Long id) {
+               this.id = id;
+    }
+
+       @Temporal(TemporalType.TIMESTAMP)
+       @Column(name = "EVENT_DATE")
+    public Date getDate() {
+               return date;
+    }
+
+    public void setDate(Date date) {
+               this.date = date;
+    }
+
+    public String getTitle() {
+               return title;
+    }
+
+    public void setTitle(String title) {
+               this.title = title;
+    }
+}
\ No newline at end of file
diff --git a/src/it/tutorials-4.3.9/entitymanager/src/test/resources/META-INF/persistence.xml b/src/it/tutorials-4.3.9/entitymanager/src/test/resources/META-INF/persistence.xml
new file mode 100644 (file)
index 0000000..ac11225
--- /dev/null
@@ -0,0 +1,48 @@
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+  ~ indicated by the @author tags or express copyright attribution
+  ~ statements applied by the authors.  All third-party contributions are
+  ~ distributed under license by Red Hat Inc.
+  ~
+  ~ This copyrighted material is made available to anyone wishing to use, modify,
+  ~ copy, or redistribute it subject to the terms and conditions of the GNU
+  ~ Lesser General Public License, as published by the Free Software Foundation.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+  ~ for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public License
+  ~ along with this distribution; if not, write to:
+  ~ Free Software Foundation, Inc.
+  ~ 51 Franklin Street, Fifth Floor
+  ~ Boston, MA  02110-1301  USA
+  -->
+<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="org.hibernate.tutorial.jpa">
+        <description>
+            Persistence unit for the JPA tutorial of the Hibernate Getting Started Guide
+        </description>
+
+        <class>org.hibernate.tutorial.em.Event</class>
+
+        <properties>
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:${project.build.directory}/db/test;MVCC=TRUE" />
+            <property name="javax.persistence.jdbc.user" value="sa" />
+            <property name="javax.persistence.jdbc.password" value="" />
+
+            <property name="hibernate.show_sql" value="true" />
+            <property name="hibernate.hbm2ddl.auto" value="create" />
+        </properties>
+
+    </persistence-unit>
+
+</persistence>
diff --git a/src/it/tutorials-4.3.9/envers/pom.xml b/src/it/tutorials-4.3.9/envers/pom.xml
new file mode 100644 (file)
index 0000000..f5d8769
--- /dev/null
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+  ~ indicated by the @author tags or express copyright attribution
+  ~ statements applied by the authors.  All third-party contributions are
+  ~ distributed under license by Red Hat Inc.
+  ~
+  ~ This copyrighted material is made available to anyone wishing to use, modify,
+  ~ copy, or redistribute it subject to the terms and conditions of the GNU
+  ~ Lesser General Public License, as published by the Free Software Foundation.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+  ~ for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public License
+  ~ along with this distribution; if not, write to:
+  ~ Free Software Foundation, Inc.
+  ~ 51 Franklin Street, Fifth Floor
+  ~ Boston, MA  02110-1301  USA
+  -->
+<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>
+
+    <parent>
+        <groupId>org.hibernate.tutorials</groupId>
+        <artifactId>hibernate-tutorials</artifactId>
+        <version>4.3.9.Final</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>hibernate-tutorial-envers</artifactId>
+    <name>Hibernate Envers Tutorial</name>
+    <description>Hibernate tutorial illustrating basic set up and use of Envers</description>
+
+    <properties>
+        <!-- Skip artifact deployment -->
+        <maven.deploy.skip>true</maven.deploy.skip>
+        <h4mp.version>@project.version@</h4mp.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-envers</artifactId>
+            <version>4.3.9.Final</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-entitymanager</artifactId>
+            <version>4.3.9.Final</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>de.juplo</groupId>
+                <artifactId>hibernate-maven-plugin</artifactId>
+                <version>${h4mp.version}</version>
+                <executions>
+                    <execution>
+                        <phase>process-test-classes</phase>
+                        <goals>
+                            <goal>create</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <scanTestClasses>true</scanTestClasses>
+                    <dialect>org.hibernate.dialect.H2Dialect</dialect>
+                    <format>true</format>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/src/it/tutorials-4.3.9/envers/src/test/java/org/hibernate/tutorial/envers/EnversIllustrationTest.java b/src/it/tutorials-4.3.9/envers/src/test/java/org/hibernate/tutorial/envers/EnversIllustrationTest.java
new file mode 100644 (file)
index 0000000..5e29faa
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.envers;
+
+import java.util.Date;
+import java.util.List;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import junit.framework.TestCase;
+
+import org.hibernate.envers.AuditReader;
+import org.hibernate.envers.AuditReaderFactory;
+
+/**
+ * Illustrates the set up and use of Envers.
+ * <p>
+ * This example is different from the others in that we really need to save multiple revisions to the entity in
+ * order to get a good look at Envers in action.
+ *
+ * @author Steve Ebersole
+ */
+public class EnversIllustrationTest extends TestCase {
+       private EntityManagerFactory entityManagerFactory;
+
+       @Override
+       protected void setUp() throws Exception {
+               // like discussed with regards to SessionFactory, an EntityManagerFactory is set up once for an application
+               //              IMPORTANT: notice how the name here matches the name we gave the persistence-unit in persistence.xml!
+               entityManagerFactory = Persistence.createEntityManagerFactory( "org.hibernate.tutorial.envers" );
+       }
+
+       @Override
+       protected void tearDown() throws Exception {
+               entityManagerFactory.close();
+       }
+
+       public void testBasicUsage() {
+               // create a couple of events
+               EntityManager entityManager = entityManagerFactory.createEntityManager();
+               entityManager.getTransaction().begin();
+               entityManager.persist( new Event( "Our very first event!", new Date() ) );
+               entityManager.persist( new Event( "A follow up event", new Date() ) );
+               entityManager.getTransaction().commit();
+               entityManager.close();
+
+               // now lets pull events from the database and list them
+               entityManager = entityManagerFactory.createEntityManager();
+               entityManager.getTransaction().begin();
+        List<Event> result = entityManager.createQuery( "from Event", Event.class ).getResultList();
+               for ( Event event : result ) {
+                       System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
+               }
+        entityManager.getTransaction().commit();
+        entityManager.close();
+
+               // so far the code is the same as we have seen in previous tutorials.  Now lets leverage Envers...
+
+               // first lets create some revisions
+               entityManager = entityManagerFactory.createEntityManager();
+               entityManager.getTransaction().begin();
+               Event myEvent = entityManager.find( Event.class, 2L ); // we are using the increment generator, so we know 2 is a valid id
+               myEvent.setDate( new Date() );
+               myEvent.setTitle( myEvent.getTitle() + " (rescheduled)" );
+        entityManager.getTransaction().commit();
+        entityManager.close();
+
+               // and then use an AuditReader to look back through history
+               entityManager = entityManagerFactory.createEntityManager();
+               entityManager.getTransaction().begin();
+               myEvent = entityManager.find( Event.class, 2L );
+               assertEquals( "A follow up event (rescheduled)", myEvent.getTitle() );
+               AuditReader reader = AuditReaderFactory.get( entityManager );
+               Event firstRevision = reader.find( Event.class, 2L, 1 );
+               assertFalse( firstRevision.getTitle().equals( myEvent.getTitle() ) );
+               assertFalse( firstRevision.getDate().equals( myEvent.getDate() ) );
+               Event secondRevision = reader.find( Event.class, 2L, 2 );
+               assertTrue( secondRevision.getTitle().equals( myEvent.getTitle() ) );
+               assertTrue( secondRevision.getDate().equals( myEvent.getDate() ) );
+               entityManager.getTransaction().commit();
+        entityManager.close();
+       }
+}
diff --git a/src/it/tutorials-4.3.9/envers/src/test/java/org/hibernate/tutorial/envers/Event.java b/src/it/tutorials-4.3.9/envers/src/test/java/org/hibernate/tutorial/envers/Event.java
new file mode 100644 (file)
index 0000000..64741a6
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.envers;
+
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.hibernate.annotations.GenericGenerator;
+import org.hibernate.envers.Audited;
+
+@Entity
+@Table( name = "EVENTS" )
+@Audited  // <--- this tell Envers to audit (track changes to) this entity
+public class Event {
+    private Long id;
+
+    private String title;
+    private Date date;
+
+       public Event() {
+               // this form used by Hibernate
+       }
+
+       public Event(String title, Date date) {
+               // for application use, to create new events
+               this.title = title;
+               this.date = date;
+       }
+
+       @Id
+       @GeneratedValue(generator="increment")
+       @GenericGenerator(name="increment", strategy = "increment")
+    public Long getId() {
+               return id;
+    }
+
+    private void setId(Long id) {
+               this.id = id;
+    }
+
+       @Temporal(TemporalType.TIMESTAMP)
+       @Column(name = "EVENT_DATE")
+    public Date getDate() {
+               return date;
+    }
+
+    public void setDate(Date date) {
+               this.date = date;
+    }
+
+    public String getTitle() {
+               return title;
+    }
+
+    public void setTitle(String title) {
+               this.title = title;
+    }
+
+       @Override
+       public int hashCode() {
+               int result = title.hashCode();
+               result = 31 * result + date.hashCode();
+               return result;
+       }
+}
\ No newline at end of file
diff --git a/src/it/tutorials-4.3.9/envers/src/test/resources/META-INF/persistence.xml b/src/it/tutorials-4.3.9/envers/src/test/resources/META-INF/persistence.xml
new file mode 100644 (file)
index 0000000..fae7276
--- /dev/null
@@ -0,0 +1,48 @@
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+  ~ indicated by the @author tags or express copyright attribution
+  ~ statements applied by the authors.  All third-party contributions are
+  ~ distributed under license by Red Hat Inc.
+  ~
+  ~ This copyrighted material is made available to anyone wishing to use, modify,
+  ~ copy, or redistribute it subject to the terms and conditions of the GNU
+  ~ Lesser General Public License, as published by the Free Software Foundation.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+  ~ for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public License
+  ~ along with this distribution; if not, write to:
+  ~ Free Software Foundation, Inc.
+  ~ 51 Franklin Street, Fifth Floor
+  ~ Boston, MA  02110-1301  USA
+  -->
+<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="org.hibernate.tutorial.envers">
+        <description>
+            Persistence unit for the Envers tutorial of the Hibernate Getting Started Guide
+        </description>
+
+        <class>org.hibernate.tutorial.envers.Event</class>
+
+        <properties>
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:${project.build.directory}/db/test;MVCC=TRUE" />
+            <property name="javax.persistence.jdbc.user" value="sa" />
+            <property name="javax.persistence.jdbc.password" value="" />
+
+            <property name="hibernate.show_sql" value="true" />
+            <property name="hibernate.hbm2ddl.auto" value="create" />
+        </properties>
+
+    </persistence-unit>
+
+</persistence>
diff --git a/src/it/tutorials-4.3.9/osgi/managed-jpa/features.xml b/src/it/tutorials-4.3.9/osgi/managed-jpa/features.xml
new file mode 100755 (executable)
index 0000000..875daa5
--- /dev/null
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<features>
+       <feature name="hibernate-test">
+       
+           <feature>karaf-framework</feature>
+        
+        <!-- JTA -->
+        <config name="org.apache.aries.transaction">
+            aries.transaction.recoverable = true
+            aries.transaction.timeout = 600
+            aries.transaction.howl.logFileDir = /tmp/karaf/txlog
+            aries.transaction.howl.maxLogFiles = 2
+            aries.transaction.howl.maxBlocksPerFile = 512
+            aries.transaction.howl.bufferSizeKBytes = 4
+        </config>
+        <bundle dependency="true" start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
+        <bundle start-level="30">mvn:org.apache.aries.transaction/org.apache.aries.transaction.blueprint/1.0.0</bundle>
+        <bundle start-level="30">mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/1.0.1</bundle>
+        
+        <!-- JPA -->
+        <bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
+        <!-- No container currently supports JPA 2.1.  Clone and build Aries from the following fork (upgrades to
+             JPA 2.1).  Aries should be upgrading as soon as the spec is out.
+             https://github.com/brmeyer/aries/tree/jpa21 -->
+        <bundle start-level="30">mvn:org.apache.aries/org.apache.aries.util/1.1.1-SNAPSHOT</bundle>
+        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/1.0.1-SNAPSHOT</bundle>
+        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint.aries/1.0.2-SNAPSHOT</bundle>
+        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/1.0.1-SNAPSHOT</bundle>
+        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container.context/1.0.2-SNAPSHOT</bundle>
+        
+           <!-- JNDI -->
+        <bundle start-level="30">mvn:org.apache.aries/org.apache.aries.util/1.0.0</bundle>
+        <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.api/1.0.0</bundle>
+        <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.core/1.0.0</bundle>
+        <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.rmi/1.0.0</bundle>
+        <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.url/1.0.0</bundle>
+        <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.legacy.support/1.0.0</bundle>
+        
+        <!-- Taken from Karaf-Tutorial -->
+        <bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
+               <bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
+               <bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
+               <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
+               <bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
+
+               <bundle>mvn:com.h2database/h2/1.3.170</bundle>
+               <bundle>blueprint:file:/[PATH]/datasource-h2.xml</bundle>
+
+               <!-- These do not natively support OSGi, so using 3rd party bundles. -->
+               <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
+               <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
+               
+               <!-- These do not natively support OSGi, so wrap with BND. -->
+               <bundle>wrap:mvn:org.jboss/jandex/1.1.0.Alpha1</bundle>
+               
+        <bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
+        <bundle>mvn:org.jboss.logging/jboss-logging/3.1.0.GA</bundle>
+               <bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
+               
+        <bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.3.Final</bundle>
+        
+        <bundle>mvn:org.hibernate/hibernate-core/4.3.0-SNAPSHOT</bundle>
+        <bundle>mvn:org.hibernate/hibernate-entitymanager/4.3.0-SNAPSHOT</bundle>
+        
+        <!-- TODO: It seems that the persistence unit bundle needs to be started
+        before hibernate-osgi.  When the BundleActivator is started,
+        the persistence unit is provided even though managed-jpa
+        hasn't completely started yet.  If that happens, you'll get an "illegal
+        bundle state" exception.  Is there a way for the activator to
+        watch for bundles with PUs before registering the persistence provider? -->
+        <bundle>mvn:org.hibernate.osgi/managed-jpa/1.0.0</bundle>
+        
+        <bundle>mvn:org.hibernate/hibernate-osgi/4.3.0-SNAPSHOT</bundle>
+       </feature>
+</features>
diff --git a/src/it/tutorials-4.3.9/osgi/managed-jpa/pom.xml b/src/it/tutorials-4.3.9/osgi/managed-jpa/pom.xml
new file mode 100644 (file)
index 0000000..8c9fa47
--- /dev/null
@@ -0,0 +1,90 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>org.hibernate.osgi</groupId>
+       <artifactId>managed-jpa</artifactId>
+       <version>1.0.0</version>
+    <packaging>bundle</packaging>
+
+       <properties>
+               <h4mp.version>@project.version@</h4mp.version>
+       </properties>
+
+       <dependencies>
+               <dependency>
+                       <groupId>org.hibernate.javax.persistence</groupId>
+            <artifactId>hibernate-jpa-2.1-api</artifactId>
+            <version>1.0.0.Final</version>
+               </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>4.3.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.enterprise</artifactId>
+            <version>4.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+            <version>2.3.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <version>1.4.187</version>
+        </dependency>
+       </dependencies>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               <extensions>true</extensions>
+                               <configuration>
+                                       <instructions>
+                                               <Bundle-SymbolicName>org.hibernate.osgi.managed-jpa</Bundle-SymbolicName>
+                                               <Bundle-Name>managed-jpa</Bundle-Name>
+                                               <Bundle-Version>1.0.0</Bundle-Version>
+                                               <Export-Package>
+                                                   org.hibernate.osgitest,
+                                                       org.hibernate.osgitest.entity
+                                               </Export-Package>
+                                               <Import-Package>
+                                                   org.apache.felix.service.command,
+                            org.apache.felix.gogo.commands,
+                            org.apache.karaf.shell.console,
+                            org.apache.karaf.shell.commands,
+                            javax.persistence;version="[1.0.0,2.1.0]",
+                            <!-- Needed for proxying's Javassist enhancement during runtime -->
+                            org.hibernate.proxy,
+                            javassist.util.proxy,
+                            * 
+                                               </Import-Package>
+                                               <Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
+                                       </instructions>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>de.juplo</groupId>
+                               <artifactId>hibernate-maven-plugin</artifactId>
+                               <version>${h4mp.version}</version>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>create</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                               <configuration>
+                                       <url>jdbc:h2:mem:db_managed_jpa;MVCC=TRUE</url>
+                                       <format>true</format>
+                                       <execute>false</execute>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+</project>
diff --git a/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java b/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java
new file mode 100644 (file)
index 0000000..bdeaace
--- /dev/null
@@ -0,0 +1,37 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.List;
+
+import org.hibernate.osgitest.entity.DataPoint;
+
+/**
+ * @author Brett Meyer
+ */
+public interface DataPointService {
+
+       public void add(DataPoint dp);
+
+       public List<DataPoint> getAll();
+
+       public void deleteAll();
+}
diff --git a/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java b/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java
new file mode 100644 (file)
index 0000000..f324889
--- /dev/null
@@ -0,0 +1,58 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.hibernate.osgitest.entity.DataPoint;
+
+/**
+ * @author Brett Meyer
+ */
+public class DataPointServiceImpl implements DataPointService {
+
+       private EntityManager entityManager;
+
+       public void add(DataPoint dp) {
+               entityManager.persist( dp );
+               entityManager.flush();
+       }
+
+       public List<DataPoint> getAll() {
+               return entityManager.createQuery( "select d from DataPoint d", DataPoint.class ).getResultList();
+       }
+
+       public void deleteAll() {
+               entityManager.createQuery( "delete from DataPoint" ).executeUpdate();
+               entityManager.flush();
+       }
+
+       public EntityManager getEntityManager() {
+               return entityManager;
+       }
+
+       public void setEntityManager(EntityManager entityManager) {
+               this.entityManager = entityManager;
+       }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java b/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java
new file mode 100644 (file)
index 0000000..9e9844c
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "add")
+public class AddCommand implements Action {
+    @Argument(index=0, name="Name", required=true, description="Name", multiValued=false)
+    String name;
+    
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        DataPoint dp = new DataPoint();
+        dp.setName( name );
+        dpService.add( dp );
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java b/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java
new file mode 100644 (file)
index 0000000..d6c4ccf
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+
+@Command(scope = "dp", name = "deleteAll")
+public class DeleteAllCommand implements Action {
+private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+       dpService.deleteAll();
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java b/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java
new file mode 100644 (file)
index 0000000..ebdac60
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import java.util.List;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "getAll")
+public class GetAllCommand implements Action {
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        List<DataPoint> dps = dpService.getAll();
+        for (DataPoint dp : dps) {
+            System.out.println(dp.getId() + ", " + dp.getName());
+        }
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java b/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java
new file mode 100644 (file)
index 0000000..2a566d8
--- /dev/null
@@ -0,0 +1,53 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Brett Meyer
+ */
+@Entity
+public class DataPoint {
+       @Id
+       @GeneratedValue
+       private long id;
+       
+       private String 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;
+       }
+}
diff --git a/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/resources/META-INF/persistence.xml b/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/resources/META-INF/persistence.xml
new file mode 100644 (file)
index 0000000..5db3a42
--- /dev/null
@@ -0,0 +1,15 @@
+<?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"
+    version="1.0">
+    <persistence-unit name="managed-jpa" transaction-type="JTA">
+        <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/h2ds)</jta-data-source>
+        
+        <properties>
+            <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
+            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
+            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+            <property name="hibernate.archive.autodetection" value="class"/>
+        </properties>
+    </persistence-unit>
+</persistence>
\ No newline at end of file
diff --git a/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/src/it/tutorials-4.3.9/osgi/managed-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644 (file)
index 0000000..529a4e1
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<blueprint  default-activation="eager" 
+            xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0"
+            xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0">
+
+  <!-- This gets the container-managed EntityManager and injects it into the DataPointServiceImpl bean. -->
+  <bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl"> 
+      <jpa:context unitname="managed-jpa" property="entityManager"/>
+      <tx:transaction method="*" value="Required"/>
+  </bean>
+  <service ref="dpService" interface="org.hibernate.osgitest.DataPointService" />
+  
+  <!-- This demonstrates how to register your custom implementations of Hibernate extension points, such as
+       Integrator and TypeContributor. -->
+  <!-- <bean id="integrator" class="your.package.IntegratorImpl"/>
+  <service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
+  <bean id="typeContributor" class="your.package.TypeContributorImpl"/>
+  <service ref="typeContributor" interface="org.hibernate.metamodel.spi.TypeContributor"/> -->
+  
+  <!-- This bundle makes use of Karaf commands to demonstrate core persistence operations.  Feel free to remove it. -->
+  <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+        <command name="dp/add">
+            <action class="org.hibernate.osgitest.command.AddCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+        <command name="dp/getAll">
+            <action class="org.hibernate.osgitest.command.GetAllCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+        <command name="dp/deleteAll">
+            <action class="org.hibernate.osgitest.command.DeleteAllCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+    </command-bundle>
+</blueprint>
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/features.xml b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/features.xml
new file mode 100644 (file)
index 0000000..7c60a47
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<features>
+       <feature name="hibernate-test">
+       
+           <feature>karaf-framework</feature>
+           
+           <!-- JTA -->
+        <bundle start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
+        
+        <!-- JPA -->
+        <bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
+        
+        <!-- Taken from Karaf-Tutorial -->
+        <bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
+               <bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
+               <bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
+               <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
+               <bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
+
+               <bundle>mvn:com.h2database/h2/1.3.170</bundle>
+
+               <!-- These do not natively support OSGi, so using 3rd party bundles. -->
+               <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
+               <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
+               
+               <!-- These do not natively support OSGi, so wrap with BND. -->
+               <bundle>wrap:mvn:org.jboss/jandex/1.1.0.Alpha1</bundle>
+               
+        <bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
+        <bundle>mvn:org.jboss.logging/jboss-logging/3.1.0.GA</bundle>
+               <bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
+               
+        <bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.3.Final</bundle>
+        
+        <bundle>mvn:org.hibernate/hibernate-core/4.3.0-SNAPSHOT</bundle>
+        <bundle>mvn:org.hibernate/hibernate-entitymanager/4.3.0-SNAPSHOT</bundle>
+        <bundle>mvn:org.hibernate/hibernate-osgi/4.3.0-SNAPSHOT</bundle>
+        
+        <bundle>mvn:org.hibernate.osgi/unmanaged-jpa/1.0.0</bundle>
+       </feature>
+</features>
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/pom.xml b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/pom.xml
new file mode 100644 (file)
index 0000000..c4c7cd0
--- /dev/null
@@ -0,0 +1,94 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>org.hibernate.osgi</groupId>
+       <artifactId>unmanaged-jpa</artifactId>
+       <version>1.0.0</version>
+    <packaging>bundle</packaging>
+
+       <properties>
+               <h4mp.version>@project.version@</h4mp.version>
+       </properties>
+
+       <dependencies>
+               <dependency>
+            <groupId>org.hibernate.javax.persistence</groupId>
+            <artifactId>hibernate-jpa-2.1-api</artifactId>
+            <version>1.0.0.Final</version>
+        </dependency>
+               <dependency>
+                       <groupId>org.osgi</groupId>
+                       <artifactId>org.osgi.core</artifactId>
+                       <version>4.3.1</version>
+               </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.enterprise</artifactId>
+            <version>4.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+            <version>2.3.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-entitymanager</artifactId>
+            <version>4.3.9.Final</version>
+        </dependency>
+               <dependency>
+                       <groupId>com.h2database</groupId>
+                       <artifactId>h2</artifactId>
+                       <version>1.4.187</version>
+               </dependency>
+        
+       </dependencies>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               <extensions>true</extensions>
+                               <configuration>
+                                       <instructions>
+                                               <Bundle-SymbolicName>org.hibernate.osgi.unmanaged-jpa</Bundle-SymbolicName>
+                                               <Bundle-Name>unmanaged-jpa</Bundle-Name>
+                                               <Bundle-Version>1.0.0</Bundle-Version>
+                                               <Export-Package>
+                                                   org.hibernate.osgitest,
+                                                       org.hibernate.osgitest.entity
+                                               </Export-Package>
+                                               <Import-Package>
+                                                   org.apache.felix.service.command,
+                            org.apache.felix.gogo.commands,
+                            org.apache.karaf.shell.console,
+                            org.apache.karaf.shell.commands,
+                            org.h2,
+                            javax.persistence;version="[1.0.0,2.1.0]",
+                            <!-- Needed for proxying's Javassist enhancement during runtime -->
+                            org.hibernate.proxy,
+                            javassist.util.proxy,
+                            * 
+                                               </Import-Package>
+                                       </instructions>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>de.juplo</groupId>
+                               <artifactId>hibernate-maven-plugin</artifactId>
+                               <version>${h4mp.version}</version>
+                               <configuration>
+                                       <format>true</format>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>create</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+               </plugins>
+       </build>
+</project>
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java
new file mode 100644 (file)
index 0000000..de8c960
--- /dev/null
@@ -0,0 +1,41 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.List;
+
+import org.hibernate.osgitest.entity.DataPoint;
+
+/**
+ * @author Brett Meyer
+ */
+public interface DataPointService {
+
+       public void add(DataPoint dp);
+
+       public void update(DataPoint dp);
+
+       public DataPoint get(long id);
+
+       public List<DataPoint> getAll();
+
+       public void deleteAll();
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java
new file mode 100644 (file)
index 0000000..dba3609
--- /dev/null
@@ -0,0 +1,78 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.hibernate.osgitest.entity.DataPoint;
+
+/**
+ * @author Brett Meyer
+ */
+public class DataPointServiceImpl implements DataPointService {
+       
+       private HibernateUtil hibernateUtil = new HibernateUtil();
+
+       public void add(DataPoint dp) {
+               EntityManager em = hibernateUtil.getEntityManager();
+               em.getTransaction().begin();
+               em.persist( dp );
+               em.getTransaction().commit();
+               em.close();
+       }
+
+       public void update(DataPoint dp) {
+               EntityManager em = hibernateUtil.getEntityManager();
+               em.getTransaction().begin();
+               em.merge( dp );
+               em.getTransaction().commit();
+               em.close();
+       }
+
+       public DataPoint get(long id) {
+               EntityManager em = hibernateUtil.getEntityManager();
+               em.getTransaction().begin();
+               DataPoint dp = (DataPoint) em.createQuery( "from DataPoint dp where dp.id=" + id ).getSingleResult();
+               em.getTransaction().commit();
+               em.close();
+               return dp;
+       }
+
+       public List<DataPoint> getAll() {
+               EntityManager em = hibernateUtil.getEntityManager();
+               em.getTransaction().begin();
+               List list = em.createQuery( "from DataPoint" ).getResultList();
+               em.getTransaction().commit();
+               em.close();
+               return list;
+       }
+
+       public void deleteAll() {
+               EntityManager em = hibernateUtil.getEntityManager();
+               em.getTransaction().begin();
+               em.createQuery( "delete from DataPoint" ).executeUpdate();
+               em.getTransaction().commit();
+               em.close();
+       }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/HibernateUtil.java b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/HibernateUtil.java
new file mode 100644 (file)
index 0000000..0927f15
--- /dev/null
@@ -0,0 +1,57 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.spi.PersistenceProvider;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * @author Brett Meyer
+ */
+
+public class HibernateUtil {
+
+       private EntityManagerFactory emf;
+
+       public EntityManager getEntityManager() {
+               return getEntityManagerFactory().createEntityManager();
+       }
+
+       private EntityManagerFactory getEntityManagerFactory() {
+               if ( emf == null ) {
+                       Bundle thisBundle = FrameworkUtil.getBundle( HibernateUtil.class );
+                       // Could get this by wiring up OsgiTestBundleActivator as well.
+                       BundleContext context = thisBundle.getBundleContext();
+
+                       ServiceReference serviceReference = context.getServiceReference( PersistenceProvider.class.getName() );
+                       PersistenceProvider persistenceProvider = (PersistenceProvider) context.getService( serviceReference );
+
+                       emf = persistenceProvider.createEntityManagerFactory( "unmanaged-jpa", null );
+               }
+               return emf;
+       }
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestIntegrator.java b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestIntegrator.java
new file mode 100644 (file)
index 0000000..8ba8f6a
--- /dev/null
@@ -0,0 +1,47 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.engine.spi.SessionFactoryImplementor;
+import org.hibernate.integrator.spi.Integrator;
+import org.hibernate.metamodel.source.MetadataImplementor;
+import org.hibernate.service.spi.SessionFactoryServiceRegistry;
+
+
+/**
+ * @author Brett Meyer
+ */
+public class TestIntegrator implements Integrator {
+
+       public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
+               System.out.println("Integrator#integrate");
+       }
+
+       public void integrate(MetadataImplementor metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
+               System.out.println("Integrator#integrate");
+       }
+
+       public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
+               System.out.println("Integrator#disintegrate");
+       }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java
new file mode 100644 (file)
index 0000000..f7ad26f
--- /dev/null
@@ -0,0 +1,37 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.Collections;
+
+import org.hibernate.boot.registry.selector.StrategyRegistration;
+import org.hibernate.boot.registry.selector.StrategyRegistrationProvider;
+
+/**
+ * @author Brett Meyer
+ */
+public class TestStrategyRegistrationProvider implements StrategyRegistrationProvider {
+
+       public Iterable<StrategyRegistration> getStrategyRegistrations() {
+               System.out.println("StrategyRegistrationProvider#getStrategyRegistrations");
+               return Collections.EMPTY_LIST;
+       }
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestTypeContributor.java b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestTypeContributor.java
new file mode 100644 (file)
index 0000000..cc6494c
--- /dev/null
@@ -0,0 +1,37 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import org.hibernate.metamodel.spi.TypeContributions;
+import org.hibernate.metamodel.spi.TypeContributor;
+import org.hibernate.service.ServiceRegistry;
+
+
+/**
+ * @author Brett Meyer
+ */
+public class TestTypeContributor implements TypeContributor {
+
+       public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
+               System.out.println("TypeContributor#contribute");
+       }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java
new file mode 100644 (file)
index 0000000..c1b906c
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "addJPA")
+public class AddCommand implements Action {
+    @Argument(index=0, name="Name", required=true, description="Name", multiValued=false)
+    String name;
+    
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        DataPoint dp = new DataPoint();
+        dp.setName( name );
+        dpService.add( dp );
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java
new file mode 100644 (file)
index 0000000..0d404ae
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+
+@Command(scope = "dp", name = "deleteAllJPA")
+public class DeleteAllCommand implements Action {
+private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+       dpService.deleteAll();
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java
new file mode 100644 (file)
index 0000000..6873e46
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import java.util.List;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "getAllJPA")
+public class GetAllCommand implements Action {
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        List<DataPoint> dps = dpService.getAll();
+        for (DataPoint dp : dps) {
+            System.out.println(dp.getId() + ", " + dp.getName());
+        }
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java
new file mode 100644 (file)
index 0000000..5de8983
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "updateJPA")
+public class UpdateCommand implements Action {
+    @Argument(index=0, name="Id", required=true, description="Id", multiValued=false)
+    String id;
+    
+    @Argument(index=1, name="Name", required=true, description="Name", multiValued=false)
+    String name;
+    
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        DataPoint dp = dpService.get( Long.valueOf( id ) );
+        dp.setName( name );
+        dpService.update( dp );
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java
new file mode 100644 (file)
index 0000000..2a566d8
--- /dev/null
@@ -0,0 +1,53 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Brett Meyer
+ */
+@Entity
+public class DataPoint {
+       @Id
+       @GeneratedValue
+       private long id;
+       
+       private String 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;
+       }
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/resources/META-INF/persistence.xml b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/resources/META-INF/persistence.xml
new file mode 100644 (file)
index 0000000..0483f5c
--- /dev/null
@@ -0,0 +1,18 @@
+<?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"
+    version="1.0">
+    <persistence-unit name="unmanaged-jpa">
+        <class>org.hibernate.osgitest.entity.DataPoint</class>
+        <exclude-unlisted-classes>true</exclude-unlisted-classes>
+        
+        <properties>
+            <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
+            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
+            <property name="hibernate.connection.url" value="jdbc:h2:mem:db_unmanaged_jpa;DB_CLOSE_DELAY=-1;MVCC=TRUE"/>
+            <property name="hibernate.connection.username" value="sa"/>
+            <property name="hibernate.connection.password" value=""/>
+            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+        </properties>
+    </persistence-unit>
+</persistence>
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/src/it/tutorials-4.3.9/osgi/unmanaged-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644 (file)
index 0000000..2dedb95
--- /dev/null
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<blueprint  default-activation="eager" 
+            xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+  <bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl"/>
+  <service ref="dpService" interface="org.hibernate.osgitest.DataPointService" />
+  
+  <!-- This demonstrates how to register your custom implementations of Hibernate extension points. -->
+            
+  <bean id="integrator" class="org.hibernate.osgitest.TestIntegrator"/>
+  <service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
+
+  <bean id="strategyRegistrationProvider" class="org.hibernate.osgitest.TestStrategyRegistrationProvider"/>
+  <service ref="strategyRegistrationProvider" interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
+            
+  <bean id="typeContributor" class="org.hibernate.osgitest.TestTypeContributor"/>
+  <service ref="typeContributor" interface="org.hibernate.metamodel.spi.TypeContributor"/>
+  
+  <!-- This bundle makes use of Karaf commands to demonstrate core persistence operations.  Feel free to remove it. -->
+  <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+        <command name="dp:add">
+            <action class="org.hibernate.osgitest.command.AddCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+        <command name="dp:update">
+            <action class="org.hibernate.osgitest.command.UpdateCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+        <command name="dp:getAll">
+            <action class="org.hibernate.osgitest.command.GetAllCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+        <command name="dp:deleteAll">
+            <action class="org.hibernate.osgitest.command.DeleteAllCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+    </command-bundle>
+</blueprint>
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/features.xml b/src/it/tutorials-4.3.9/osgi/unmanaged-native/features.xml
new file mode 100644 (file)
index 0000000..b2e0816
--- /dev/null
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<features>
+       <feature name="hibernate-test">
+       
+           <feature>karaf-framework</feature>
+           
+           <!-- JTA -->
+        <bundle start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
+        
+        <!-- JPA -->
+        <bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
+        
+        <!-- Taken from Karaf-Tutorial -->
+        <bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
+               <bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
+               <bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
+               <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
+               <bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
+
+               <bundle>mvn:com.h2database/h2/1.3.170</bundle>
+
+               <!-- These do not natively support OSGi, so using 3rd party bundles. -->
+               <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
+               <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
+               
+               <!-- These do not natively support OSGi, so wrap with BND. -->
+               <bundle>wrap:mvn:org.jboss/jandex/1.1.0.Alpha1</bundle>
+               <!-- Optional.  Needed to test C3P0 connection pools. -->
+               <!-- <bundle>wrap:mvn:c3p0/c3p0/0.9.1</bundle> -->
+               <!-- Optional.  Needed to test Proxool connection pools. -->
+               <!-- <bundle>wrap:mvn:proxool/proxool/0.8.3</bundle> -->
+               <!-- Optional.  Needed to test ehcache 2lc. -->
+               <!-- <bundle>wrap:mvn:net.sf.ehcache/ehcache-core/2.4.3</bundle> -->
+               
+        <bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
+        <bundle>mvn:org.jboss.logging/jboss-logging/3.1.0.GA</bundle>
+               <bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
+               
+        <bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.3.Final</bundle>
+        
+        <!-- JACC is optional. -->
+        <!--<bundle>mvn:javax.servlet/javax.servlet-api/3.0.1</bundle>
+        <bundle>mvn:org.jboss.spec.javax.security.jacc/jboss-jacc-api_1.4_spec/1.0.2.Final</bundle>-->
+        
+        <!-- hibernate-validator is optional. -->
+        <!--<bundle>wrap:mvn:javax.validation/validation-api/1.0.0.GA</bundle>
+        <bundle>mvn:org.hibernate/hibernate-validator/4.2.0.Final</bundle>-->
+        
+               <!-- Optional.  Needed to test infinispan 2lc. -->
+               <!-- IMPORTANT: Infinispan requires the JRE sun.misc package.  You
+               MUST enable this in your OSGi container.  For Karaf, add
+               "org.osgi.framework.system.packages.extra=sun.misc" to etc/config.properties -->
+               <!-- <bundle>wrap:mvn:org.jboss.marshalling/jboss-marshalling/1.3.17.GA</bundle>
+               <bundle>wrap:mvn:org.jboss.marshalling/jboss-marshalling-river/1.3.17.GA</bundle>
+               <bundle>wrap:mvn:org.jboss/staxmapper/1.1.0.Final</bundle>
+               <bundle>mvn:org.jgroups/jgroups/3.2.8.Final</bundle>
+               <bundle>mvn:org.infinispan/infinispan-core/5.2.0.Beta3</bundle> -->
+
+        <bundle>mvn:org.hibernate/hibernate-core/4.3.0-SNAPSHOT</bundle>
+        <!-- TODO: Shouldn't need this, but hibernate-osgi's activator is a catch-all for SF and EMF. -->
+        <bundle>mvn:org.hibernate/hibernate-entitymanager/4.3.0-SNAPSHOT</bundle>
+        <bundle>mvn:org.hibernate/hibernate-envers/4.3.0-SNAPSHOT</bundle>
+        <!-- <bundle>mvn:org.hibernate/hibernate-c3p0/4.3.0-SNAPSHOT</bundle> -->
+        <!-- <bundle>mvn:org.hibernate/hibernate-proxool/4.3.0-SNAPSHOT</bundle> -->
+        <!-- <bundle>mvn:org.hibernate/hibernate-ehcache/4.3.0-SNAPSHOT</bundle> -->
+        <!-- <bundle>mvn:org.hibernate/hibernate-infinispan/4.3.0-SNAPSHOT</bundle> -->
+        <bundle>mvn:org.hibernate/hibernate-osgi/4.3.0-SNAPSHOT</bundle>
+        
+        <bundle>mvn:org.hibernate.osgi/unmanaged-native/1.0.0</bundle>
+       </feature>
+</features>
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/pom.xml b/src/it/tutorials-4.3.9/osgi/unmanaged-native/pom.xml
new file mode 100644 (file)
index 0000000..f91f11a
--- /dev/null
@@ -0,0 +1,102 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>org.hibernate.osgi</groupId>
+       <artifactId>unmanaged-native</artifactId>
+       <version>1.0.0</version>
+    <packaging>bundle</packaging>
+
+       <properties>
+               <h4mp.version>@project.version@</h4mp.version>
+       </properties>
+
+       <dependencies>
+               <dependency>
+            <groupId>org.hibernate.javax.persistence</groupId>
+            <artifactId>hibernate-jpa-2.1-api</artifactId>
+            <version>1.0.0.Final</version>
+        </dependency>
+               <dependency>
+                       <groupId>org.osgi</groupId>
+                       <artifactId>org.osgi.core</artifactId>
+                       <version>4.3.1</version>
+               </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.enterprise</artifactId>
+            <version>4.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+            <version>2.3.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-core</artifactId>
+            <version>4.3.9.Final</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-envers</artifactId>
+            <version>4.3.9.Final</version>
+        </dependency>
+               <dependency>
+                       <groupId>com.h2database</groupId>
+                       <artifactId>h2</artifactId>
+                       <version>1.4.187</version>
+               </dependency>
+        
+       </dependencies>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               <extensions>true</extensions>
+                               <configuration>
+                                       <instructions>
+                                               <Bundle-SymbolicName>org.hibernate.osgi.unmanaged-native</Bundle-SymbolicName>
+                                               <Bundle-Name>unmanaged-native</Bundle-Name>
+                                               <Bundle-Version>1.0.0</Bundle-Version>
+                                               <Export-Package>
+                                                   org.hibernate.osgitest,
+                                                       org.hibernate.osgitest.entity
+                                               </Export-Package>
+                                               <Import-Package>
+                                                   org.apache.felix.service.command,
+                            org.apache.felix.gogo.commands,
+                            org.apache.karaf.shell.console,
+                            org.apache.karaf.shell.commands,
+                            org.h2,
+                            org.hibernate,
+                            org.hibernate.cfg,
+                            org.hibernate.service,
+                            javax.persistence;version="[1.0.0,2.1.0]",
+                            <!-- Needed for proxying's Javassist enhancement during runtime -->
+                            org.hibernate.proxy,
+                            javassist.util.proxy,
+                            * 
+                                               </Import-Package>
+                                       </instructions>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>de.juplo</groupId>
+                               <artifactId>hibernate-maven-plugin</artifactId>
+                               <version>${h4mp.version}</version>
+                               <configuration>
+                                       <format>true</format>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>create</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+               </plugins>
+       </build>
+</project>
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointService.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointService.java
new file mode 100644 (file)
index 0000000..12fb79a
--- /dev/null
@@ -0,0 +1,47 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.List;
+import java.util.Map;
+
+import org.hibernate.envers.DefaultRevisionEntity;
+import org.hibernate.osgitest.entity.DataPoint;
+
+/**
+ * @author Brett Meyer
+ */
+public interface DataPointService {
+
+       public void add(DataPoint dp);
+
+       public void update(DataPoint dp);
+
+       public DataPoint get(long id);
+
+       public DataPoint load(long id);
+
+       public List<DataPoint> getAll();
+
+       public Map<Number, DefaultRevisionEntity> getRevisions(long id);
+
+       public void deleteAll();
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java
new file mode 100644 (file)
index 0000000..721b740
--- /dev/null
@@ -0,0 +1,104 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.hibernate.Hibernate;
+import org.hibernate.Session;
+import org.hibernate.criterion.Restrictions;
+import org.hibernate.envers.AuditReader;
+import org.hibernate.envers.AuditReaderFactory;
+import org.hibernate.envers.DefaultRevisionEntity;
+import org.hibernate.osgitest.entity.DataPoint;
+
+/**
+ * @author Brett Meyer
+ */
+public class DataPointServiceImpl implements DataPointService {
+       
+       private HibernateUtil hibernateUtil = new HibernateUtil();
+
+       public void add(DataPoint dp) {
+               Session s = hibernateUtil.getSession();
+               s.getTransaction().begin();
+               s.persist( dp );
+               s.getTransaction().commit();
+               s.close();
+       }
+
+       public void update(DataPoint dp) {
+               Session s = hibernateUtil.getSession();
+               s.getTransaction().begin();
+               s.update( dp );
+               s.getTransaction().commit();
+               s.close();
+       }
+
+       public DataPoint get(long id) {
+               Session s = hibernateUtil.getSession();
+               s.getTransaction().begin();
+               DataPoint dp = (DataPoint) s.createCriteria( DataPoint.class ).add(
+                               Restrictions.eq( "id", id ) ).uniqueResult();
+               s.getTransaction().commit();
+               s.close();
+               return dp;
+       }
+
+       // Test lazy loading (mainly to make sure the proxy classes work in OSGi)
+       public DataPoint load(long id) {
+               Session s = hibernateUtil.getSession();
+               s.getTransaction().begin();
+               DataPoint dp = (DataPoint) s.load( DataPoint.class, new Long(id) );
+               // initialize
+               dp.getName();
+               s.getTransaction().commit();
+               s.close();
+               return dp;
+       }
+
+       public List<DataPoint> getAll() {
+               Session s = hibernateUtil.getSession();
+               s.getTransaction().begin();
+               List list = s.createQuery( "from DataPoint" ).list();
+               s.getTransaction().commit();
+               s.close();
+               return list;
+       }
+       
+       public Map<Number, DefaultRevisionEntity> getRevisions(long id) {
+               Session s = hibernateUtil.getSession();
+               AuditReader reader = AuditReaderFactory.get(s);
+               List<Number> revisionNums = reader.getRevisions( DataPoint.class, id );
+               return reader.findRevisions( DefaultRevisionEntity.class, new HashSet<Number>(revisionNums) );
+       }
+
+       public void deleteAll() {
+               Session s = hibernateUtil.getSession();
+               s.getTransaction().begin();
+               s.createQuery( "delete from DataPoint" ).executeUpdate();
+               s.getTransaction().commit();
+               s.close();
+       }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/HibernateUtil.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/HibernateUtil.java
new file mode 100644 (file)
index 0000000..15fb4c7
--- /dev/null
@@ -0,0 +1,53 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * @author Brett Meyer
+ */
+
+public class HibernateUtil {
+
+       private SessionFactory sf;
+
+       public Session getSession() {
+               return getSessionFactory().openSession();
+       }
+
+       private SessionFactory getSessionFactory() {
+               if ( sf == null ) {
+                       Bundle thisBundle = FrameworkUtil.getBundle( HibernateUtil.class );
+                       // Could get this by wiring up OsgiTestBundleActivator as well.
+                       BundleContext context = thisBundle.getBundleContext();
+
+                       ServiceReference sr = context.getServiceReference( SessionFactory.class.getName() );
+                       sf = (SessionFactory) context.getService( sr );
+               }
+               return sf;
+       }
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestIntegrator.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestIntegrator.java
new file mode 100644 (file)
index 0000000..8ba8f6a
--- /dev/null
@@ -0,0 +1,47 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.engine.spi.SessionFactoryImplementor;
+import org.hibernate.integrator.spi.Integrator;
+import org.hibernate.metamodel.source.MetadataImplementor;
+import org.hibernate.service.spi.SessionFactoryServiceRegistry;
+
+
+/**
+ * @author Brett Meyer
+ */
+public class TestIntegrator implements Integrator {
+
+       public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
+               System.out.println("Integrator#integrate");
+       }
+
+       public void integrate(MetadataImplementor metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
+               System.out.println("Integrator#integrate");
+       }
+
+       public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
+               System.out.println("Integrator#disintegrate");
+       }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java
new file mode 100644 (file)
index 0000000..f7ad26f
--- /dev/null
@@ -0,0 +1,37 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.Collections;
+
+import org.hibernate.boot.registry.selector.StrategyRegistration;
+import org.hibernate.boot.registry.selector.StrategyRegistrationProvider;
+
+/**
+ * @author Brett Meyer
+ */
+public class TestStrategyRegistrationProvider implements StrategyRegistrationProvider {
+
+       public Iterable<StrategyRegistration> getStrategyRegistrations() {
+               System.out.println("StrategyRegistrationProvider#getStrategyRegistrations");
+               return Collections.EMPTY_LIST;
+       }
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestTypeContributor.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestTypeContributor.java
new file mode 100644 (file)
index 0000000..cc6494c
--- /dev/null
@@ -0,0 +1,37 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import org.hibernate.metamodel.spi.TypeContributions;
+import org.hibernate.metamodel.spi.TypeContributor;
+import org.hibernate.service.ServiceRegistry;
+
+
+/**
+ * @author Brett Meyer
+ */
+public class TestTypeContributor implements TypeContributor {
+
+       public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
+               System.out.println("TypeContributor#contribute");
+       }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/AddCommand.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/AddCommand.java
new file mode 100644 (file)
index 0000000..9e9844c
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "add")
+public class AddCommand implements Action {
+    @Argument(index=0, name="Name", required=true, description="Name", multiValued=false)
+    String name;
+    
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        DataPoint dp = new DataPoint();
+        dp.setName( name );
+        dpService.add( dp );
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java
new file mode 100644 (file)
index 0000000..d6c4ccf
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+
+@Command(scope = "dp", name = "deleteAll")
+public class DeleteAllCommand implements Action {
+private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+       dpService.deleteAll();
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java
new file mode 100644 (file)
index 0000000..ebdac60
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import java.util.List;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "getAll")
+public class GetAllCommand implements Action {
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        List<DataPoint> dps = dpService.getAll();
+        for (DataPoint dp : dps) {
+            System.out.println(dp.getId() + ", " + dp.getName());
+        }
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetCommand.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetCommand.java
new file mode 100644 (file)
index 0000000..0597d70
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "get")
+public class GetCommand implements Action {
+       @Argument(index = 0, name = "Id", required = true, description = "Id", multiValued = false)
+       String id;
+
+       private DataPointService dpService;
+
+       public void setDpService(DataPointService dpService) {
+               this.dpService = dpService;
+       }
+
+       public Object execute(CommandSession session) throws Exception {
+               DataPoint dp = dpService.get( Long.valueOf( id ) );
+               System.out.println( dp.getId() + ", " + dp.getName() );
+               return null;
+       }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetRevisionsCommand.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetRevisionsCommand.java
new file mode 100644 (file)
index 0000000..b4573f6
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import java.util.Map;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.envers.DefaultRevisionEntity;
+import org.hibernate.osgitest.DataPointService;
+
+@Command(scope = "dp", name = "getRevisions")
+public class GetRevisionsCommand implements Action {
+       @Argument(index=0, name="Id", required=true, description="Id", multiValued=false)
+    String id;
+       
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+       Map<Number, DefaultRevisionEntity> revisions = dpService.getRevisions(Long.valueOf( id ));
+        for (Number revisionNum : revisions.keySet()) {
+               DefaultRevisionEntity dre = revisions.get( revisionNum );
+            System.out.println(revisionNum + ": " + dre.getId() + ", " + dre.getTimestamp());
+        }
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/LoadCommand.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/LoadCommand.java
new file mode 100644 (file)
index 0000000..3451a98
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "load")
+public class LoadCommand implements Action {
+       @Argument(index = 0, name = "Id", required = true, description = "Id", multiValued = false)
+       String id;
+
+       private DataPointService dpService;
+
+       public void setDpService(DataPointService dpService) {
+               this.dpService = dpService;
+       }
+
+       public Object execute(CommandSession session) throws Exception {
+               DataPoint dp = dpService.load( Long.valueOf( id ) );
+               System.out.println( dp.getId() + ", " + dp.getName() );
+               return null;
+       }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java
new file mode 100644 (file)
index 0000000..f694967
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "update")
+public class UpdateCommand implements Action {
+    @Argument(index=0, name="Id", required=true, description="Id", multiValued=false)
+    String id;
+    
+    @Argument(index=1, name="Name", required=true, description="Name", multiValued=false)
+    String name;
+    
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        DataPoint dp = dpService.get( Long.valueOf( id ) );
+        dp.setName( name );
+        dpService.update( dp );
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/entity/DataPoint.java b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/entity/DataPoint.java
new file mode 100644 (file)
index 0000000..2e5ef72
--- /dev/null
@@ -0,0 +1,58 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest.entity;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Brett Meyer
+ */
+@Entity
+@Audited
+public class DataPoint implements Serializable {
+       @Id
+       @GeneratedValue
+       private long id;
+       
+       private String 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;
+       }
+}
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644 (file)
index 0000000..3f4b2b4
--- /dev/null
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<blueprint  default-activation="eager" 
+            xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+  <bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl"/>
+  <service ref="dpService" interface="org.hibernate.osgitest.DataPointService" />
+  
+  <!-- This demonstrates how to register your custom implementations of Hibernate extension points. -->
+            
+  <bean id="integrator" class="org.hibernate.osgitest.TestIntegrator"/>
+  <service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
+
+  <bean id="strategyRegistrationProvider" class="org.hibernate.osgitest.TestStrategyRegistrationProvider"/>
+  <service ref="strategyRegistrationProvider" interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
+            
+  <bean id="typeContributor" class="org.hibernate.osgitest.TestTypeContributor"/>
+  <service ref="typeContributor" interface="org.hibernate.metamodel.spi.TypeContributor"/>
+  
+  <!-- This bundle makes use of Karaf commands to demonstrate core persistence operations.  Feel free to remove it. -->
+  <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+        <command name="dp:add">
+            <action class="org.hibernate.osgitest.command.AddCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+        <command name="dp:update">
+            <action class="org.hibernate.osgitest.command.UpdateCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+        <command name="dp:get">
+            <action class="org.hibernate.osgitest.command.GetCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+        <command name="dp:load">
+            <action class="org.hibernate.osgitest.command.LoadCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+        <command name="dp:getAll">
+            <action class="org.hibernate.osgitest.command.GetAllCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+        <command name="dp:getRevisions">
+            <action class="org.hibernate.osgitest.command.GetRevisionsCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+        <command name="dp:deleteAll">
+            <action class="org.hibernate.osgitest.command.DeleteAllCommand">
+                <property name="dpService" ref="dpService"/>
+            </action>
+        </command>
+    </command-bundle>
+</blueprint>
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/resources/ehcache.xml b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/resources/ehcache.xml
new file mode 100644 (file)
index 0000000..11fddc7
--- /dev/null
@@ -0,0 +1,111 @@
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+  ~ indicated by the @author tags or express copyright attribution
+  ~ statements applied by the authors. All third-party contributions are
+  ~ distributed under license by Red Hat Middleware LLC.
+  ~
+  ~ This copyrighted material is made available to anyone wishing to use, modify,
+  ~ copy, or redistribute it subject to the terms and conditions of the GNU
+  ~ Lesser General Public License, as published by the Free Software Foundation.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+  ~ for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public License
+  ~ along with this distribution; if not, write to:
+  ~ Free Software Foundation, Inc.
+  ~ 51 Franklin Street, Fifth Floor
+  ~ Boston, MA  02110-1301  USA
+  -->
+<ehcache>
+
+    <!-- Sets the path to the directory where cache .data files are created.
+
+         If the path is a Java System Property it is replaced by
+         its value in the running VM.
+
+         The following properties are translated:
+         user.home - User's home directory
+         user.dir - User's current working directory
+         java.io.tmpdir - Default temp file path -->
+    <diskStore path="./target/tmp"/>
+
+
+    <!--Default Cache configuration. These will applied to caches programmatically created through
+        the CacheManager.
+
+        The following attributes are required for defaultCache:
+
+        maxInMemory       - Sets the maximum number of objects that will be created in memory
+        eternal           - Sets whether elements are eternal. If eternal,  timeouts are ignored and the element
+                            is never expired.
+        timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
+                            if the element is not eternal. Idle time is now - last accessed time
+        timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
+                            if the element is not eternal. TTL is now - creation time
+        overflowToDisk    - Sets whether elements can overflow to disk when the in-memory cache
+                            has reached the maxInMemory limit.
+
+        -->
+    <defaultCache
+        maxElementsInMemory="10000"
+        eternal="false"
+        timeToIdleSeconds="120"
+        timeToLiveSeconds="120"
+        overflowToDisk="true"
+        />
+
+    <!--Predefined caches.  Add your cache configuration settings here.
+        If you do not have a configuration for your cache a WARNING will be issued when the
+        CacheManager starts
+
+        The following attributes are required for defaultCache:
+
+        name              - Sets the name of the cache. This is used to identify the cache. It must be unique.
+        maxInMemory       - Sets the maximum number of objects that will be created in memory
+        eternal           - Sets whether elements are eternal. If eternal,  timeouts are ignored and the element
+                            is never expired.
+        timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
+                            if the element is not eternal. Idle time is now - last accessed time
+        timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
+                            if the element is not eternal. TTL is now - creation time
+        overflowToDisk    - Sets whether elements can overflow to disk when the in-memory cache
+                            has reached the maxInMemory limit.
+
+        -->
+
+    <!-- Sample cache named sampleCache1
+        This cache contains a maximum in memory of 10000 elements, and will expire
+        an element if it is idle for more than 5 minutes and lives for more than
+        10 minutes.
+
+        If there are more than 10000 elements it will overflow to the
+        disk cache, which in this configuration will go to wherever java.io.tmp is
+        defined on your system. On a standard Linux system this will be /tmp"
+        -->
+    <cache name="sampleCache1"
+        maxElementsInMemory="10000"
+        eternal="false"
+        timeToIdleSeconds="300"
+        timeToLiveSeconds="600"
+        overflowToDisk="true"
+        />
+
+    <!-- Sample cache named sampleCache2
+        This cache contains 1000 elements. Elements will always be held in memory.
+        They are not expired. -->
+    <cache name="sampleCache2"
+        maxElementsInMemory="1000"
+        eternal="true"
+        timeToIdleSeconds="0"
+        timeToLiveSeconds="0"
+        overflowToDisk="false"
+        /> -->
+
+    <!-- Place configuration for your caches following -->
+
+</ehcache>
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/resources/hibernate.cfg.xml b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/resources/hibernate.cfg.xml
new file mode 100644 (file)
index 0000000..f367c53
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!DOCTYPE hibernate-configuration PUBLIC
+"-//Hibernate/Hibernate Configuration DTD//EN"
+"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+    <session-factory>
+        <property name="hibernate.connection.driver_class">org.h2.Driver</property>
+        <property name="hibernate.connection.url">jdbc:h2:mem:db_unmanaged_native;DB_CLOSE_DELAY=-1;MVCC=TRUE</property>
+        <property name="hibernate.connection.username">sa</property>
+        <property name="hibernate.connection.password"></property>
+        <property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
+        <property name="hibernate.hbm2ddl.auto">create-drop</property>
+        
+        <!-- <property name="hibernate.connection.pool_size">5</property>
+               <property name="hibernate.c3p0.min_size">50</property>
+               <property name="hibernate.c3p0.max_size">800</property>
+               <property name="hibernate.c3p0.max_statements">50</property>
+               <property name="hibernate.jdbc.batch_size">10</property>
+               <property name="hibernate.c3p0.timeout">300</property>
+               <property name="hibernate.c3p0.idle_test_period">3000</property>
+               <property name="hibernate.c3p0.testConnectionOnCheckout">true</property> -->
+               
+               <!-- <property name="hibernate.connection.pool_size">5</property>
+               <property name="hibernate.jdbc.batch_size">10</property>
+               <property name="hibernate.connection.provider_class">proxool</property>
+               <property name="hibernate.proxool.properties">pool-one.properties</property>
+               <property name="hibernate.proxool.pool_alias">pool-one</property> -->
+               
+               <!-- <property name="hibernate.cache.region_prefix">hibernate.test</property>
+               <property name="cache.use_query_cache">true</property>
+        <property name="cache.use_second_level_cache">true</property>
+        <property name="cache.use_structured_entries">true</property>
+        <property name="cache.region.factory_class">org.hibernate.cache.EhCacheRegionFactory</property>
+        <property name="net.sf.ehcache.configurationResourceName">file:///[PATH]/unmanaged-jpa/src/main/resources/ehcache.xml</property> -->
+    
+        <!-- <property name="hibernate.cache.region_prefix">hibernate.test</property>
+               <property name="cache.use_query_cache">true</property>
+        <property name="cache.use_second_level_cache">true</property>
+        <property name="cache.use_structured_entries">true</property>
+        <property name="cache.region.factory_class">org.hibernate.cache.infinispan.InfinispanRegionFactory</property> -->
+        
+        <mapping class="org.hibernate.osgitest.entity.DataPoint"/>
+    </session-factory>
+</hibernate-configuration>
diff --git a/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/resources/pool-one.properties b/src/it/tutorials-4.3.9/osgi/unmanaged-native/src/main/resources/pool-one.properties
new file mode 100644 (file)
index 0000000..0a372bd
--- /dev/null
@@ -0,0 +1,7 @@
+jdbc-0.proxool.alias=pool-one
+jdbc-0.proxool.driver-url=jdbc:h2:mem:db_unmanaged_native;DB_CLOSE_DELAY=-1;MVCC=TRUE
+jdbc-0.proxool.driver-class=org.h2.Driver
+jdbc-0.user=sa
+jdbc-0.password=
+jdbc-0.proxool.maximum-connection-count=2
+jdbc-0.proxool.house-keeping-test-sql=select CURRENT_DATE
diff --git a/src/it/tutorials-4.3.9/pom.xml b/src/it/tutorials-4.3.9/pom.xml
new file mode 100644 (file)
index 0000000..e899e4c
--- /dev/null
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+  ~ indicated by the @author tags or express copyright attribution
+  ~ statements applied by the authors.  All third-party contributions are
+  ~ distributed under license by Red Hat Inc.
+  ~
+  ~ This copyrighted material is made available to anyone wishing to use, modify,
+  ~ copy, or redistribute it subject to the terms and conditions of the GNU
+  ~ Lesser General Public License, as published by the Free Software Foundation.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+  ~ for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public License
+  ~ along with this distribution; if not, write to:
+  ~ Free Software Foundation, Inc.
+  ~ 51 Franklin Street, Fifth Floor
+  ~ Boston, MA  02110-1301  USA
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.hibernate.tutorials</groupId>
+    <artifactId>hibernate-tutorials</artifactId>
+    <version>4.3.9.Final</version>
+    <packaging>pom</packaging>
+
+    <name>Hibernate Getting Started Guide Tutorials</name>
+    <description>Aggregator for the Hibernate tutorials presented in the Getting Started Guide</description>
+
+    <properties>
+        <!-- Skip artifact deployment -->
+        <maven.deploy.skip>true</maven.deploy.skip>
+    </properties>
+
+    <modules>
+        <module>basic</module>
+        <module>annotations</module>
+        <module>entitymanager</module>
+        <module>envers</module>
+        <module>osgi/unmanaged-native</module>
+        <module>osgi/unmanaged-jpa</module>
+        <module>osgi/managed-jpa</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-core</artifactId>
+            <version>4.3.9.Final</version>
+        </dependency>
+
+        <!-- Hibernate uses jboss-logging for logging, for the tutorials we will use the sl4fj-simple backend -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <version>1.7.12</version>
+        </dependency>
+
+        <!-- The tutorials use JUnit test cases to illustrate usage -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+        </dependency>
+
+        <!-- The tutorials use the H2 in-memory database -->
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <version>1.4.187</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <testResources>
+            <testResource>
+                <filtering>false</filtering>
+                <directory>src/test/java</directory>
+                <includes>
+                    <include>**/*.xml</include>
+                </includes>
+            </testResource>
+            <testResource>
+                <directory>src/test/resources</directory>
+                <filtering>true</filtering>
+            </testResource>
+        </testResources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.3</version>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                    <encoding>utf8</encoding>
+                    <showWarnings>true</showWarnings>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/src/it/tutorials-4.3.9/schema-annotations.sql b/src/it/tutorials-4.3.9/schema-annotations.sql
new file mode 100644 (file)
index 0000000..48eb18e
--- /dev/null
@@ -0,0 +1,7 @@
+
+    create table EVENTS (
+        id bigint not null,
+        EVENT_DATE timestamp,
+        title varchar(255),
+        primary key (id)
+    );
diff --git a/src/it/tutorials-4.3.9/schema-basic.sql b/src/it/tutorials-4.3.9/schema-basic.sql
new file mode 100644 (file)
index 0000000..c5e2c0e
--- /dev/null
@@ -0,0 +1,7 @@
+
+    create table EVENTS (
+        EVENT_ID bigint not null,
+        EVENT_DATE timestamp,
+        title varchar(255),
+        primary key (EVENT_ID)
+    );
diff --git a/src/it/tutorials-4.3.9/schema-entitymanager.sql b/src/it/tutorials-4.3.9/schema-entitymanager.sql
new file mode 100644 (file)
index 0000000..48eb18e
--- /dev/null
@@ -0,0 +1,7 @@
+
+    create table EVENTS (
+        id bigint not null,
+        EVENT_DATE timestamp,
+        title varchar(255),
+        primary key (id)
+    );
diff --git a/src/it/tutorials-4.3.9/schema-envers.sql b/src/it/tutorials-4.3.9/schema-envers.sql
new file mode 100644 (file)
index 0000000..ecec80e
--- /dev/null
@@ -0,0 +1,27 @@
+
+    create table EVENTS (
+        id bigint not null,
+        EVENT_DATE timestamp,
+        title varchar(255),
+        primary key (id)
+    );
+
+    create table EVENTS_AUD (
+        id bigint not null,
+        REV integer not null,
+        REVTYPE tinyint,
+        EVENT_DATE timestamp,
+        title varchar(255),
+        primary key (id, REV)
+    );
+
+    create table REVINFO (
+        REV integer generated by default as identity,
+        REVTSTMP bigint,
+        primary key (REV)
+    );
+
+    alter table EVENTS_AUD 
+        add constraint FK5cembm6xahf542q8e4h0pq2t1 
+        foreign key (REV) 
+        references REVINFO;
diff --git a/src/it/tutorials-4.3.9/schema-osgi-managed-jpa.sql b/src/it/tutorials-4.3.9/schema-osgi-managed-jpa.sql
new file mode 100644 (file)
index 0000000..de92e46
--- /dev/null
@@ -0,0 +1,7 @@
+create sequence hibernate_sequence start with 1 increment by 1;
+
+    create table DataPoint (
+        id bigint not null,
+        name varchar(255),
+        primary key (id)
+    );
diff --git a/src/it/tutorials-4.3.9/schema-osgi-unmanaged-jpa.sql b/src/it/tutorials-4.3.9/schema-osgi-unmanaged-jpa.sql
new file mode 100644 (file)
index 0000000..de92e46
--- /dev/null
@@ -0,0 +1,7 @@
+create sequence hibernate_sequence start with 1 increment by 1;
+
+    create table DataPoint (
+        id bigint not null,
+        name varchar(255),
+        primary key (id)
+    );
diff --git a/src/it/tutorials-4.3.9/schema-osgi-unmanaged-native.sql b/src/it/tutorials-4.3.9/schema-osgi-unmanaged-native.sql
new file mode 100644 (file)
index 0000000..d89e280
--- /dev/null
@@ -0,0 +1,26 @@
+create sequence hibernate_sequence start with 1 increment by 1;
+
+    create table DataPoint (
+        id bigint not null,
+        name varchar(255),
+        primary key (id)
+    );
+
+    create table DataPoint_AUD (
+        id bigint not null,
+        REV integer not null,
+        REVTYPE tinyint,
+        name varchar(255),
+        primary key (id, REV)
+    );
+
+    create table REVINFO (
+        REV integer generated by default as identity,
+        REVTSTMP bigint,
+        primary key (REV)
+    );
+
+    alter table DataPoint_AUD 
+        add constraint FK43jw6b5mtbfxur0xhyjxynbea 
+        foreign key (REV) 
+        references REVINFO;
diff --git a/src/it/tutorials-4.3.9/verify.bsh b/src/it/tutorials-4.3.9/verify.bsh
new file mode 100644 (file)
index 0000000..9156c4a
--- /dev/null
@@ -0,0 +1,19 @@
+import de.juplo.test.FileComparator;
+
+
+FileComparator comparator = new FileComparator(basedir);
+
+if (!comparator.isEqual("schema-annotations.sql","annotations/target/create.sql"))
+  return false;
+if (!comparator.isEqual("schema-basic.sql","basic/target/create.sql"))
+  return false;
+if (!comparator.isEqual("schema-entitymanager.sql","entitymanager/target/create.sql"))
+  return false;
+if (!comparator.isEqual("schema-envers.sql","envers/target/create.sql"))
+  return false;
+if (!comparator.isEqual("schema-osgi-managed-jpa.sql","osgi/managed-jpa/target/create.sql"))
+  return false;
+if (!comparator.isEqual("schema-osgi-unmanaged-jpa.sql","osgi/unmanaged-jpa/target/create.sql"))
+  return false;
+if (!comparator.isEqual("schema-osgi-unmanaged-native.sql","osgi/unmanaged-native/target/create.sql"))
+  return false;
diff --git a/src/it/tutorials-5.2.18/annotations/pom.xml b/src/it/tutorials-5.2.18/annotations/pom.xml
new file mode 100644 (file)
index 0000000..effd4b7
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<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>
+
+    <parent>
+        <groupId>org.hibernate.tutorials</groupId>
+        <artifactId>hibernate-tutorials</artifactId>
+        <version>5.2.18.Final</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>hibernate-tutorial-annotations</artifactId>
+    <name>Hibernate Annotations Tutorial</name>
+    <description>Hibernate tutorial illustrating the use of native APIs and annotations for mapping metadata</description>
+
+    <properties>
+        <!-- Skip artifact deployment -->
+        <maven.deploy.skip>true</maven.deploy.skip>
+    </properties>
+
+</project>
diff --git a/src/it/tutorials-5.2.18/annotations/src/test/java/org/hibernate/tutorial/annotations/AnnotationsIllustrationTest.java b/src/it/tutorials-5.2.18/annotations/src/test/java/org/hibernate/tutorial/annotations/AnnotationsIllustrationTest.java
new file mode 100644 (file)
index 0000000..33e2862
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.annotations;
+
+import java.util.Date;
+import java.util.List;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.boot.MetadataSources;
+import org.hibernate.boot.registry.StandardServiceRegistry;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+
+import junit.framework.TestCase;
+
+/**
+ * Illustrates the use of Hibernate native APIs.  The code here is unchanged from the {@code basic} example, the
+ * only difference being the use of annotations to supply the metadata instead of Hibernate mapping files.
+ *
+ * @author Steve Ebersole
+ */
+public class AnnotationsIllustrationTest extends TestCase {
+       private SessionFactory sessionFactory;
+
+       @Override
+       protected void setUp() throws Exception {
+               // A SessionFactory is set up once for an application!
+               final StandardServiceRegistry registry = new StandardServiceRegistryBuilder()
+                               .configure() // configures settings from hibernate.cfg.xml
+                               .build();
+               try {
+                       sessionFactory = new MetadataSources( registry ).buildMetadata().buildSessionFactory();
+               }
+               catch (Exception e) {
+                       // The registry would be destroyed by the SessionFactory, but we had trouble building the SessionFactory
+                       // so destroy it manually.
+                       StandardServiceRegistryBuilder.destroy( registry );
+               }
+       }
+
+       @Override
+       protected void tearDown() throws Exception {
+               if ( sessionFactory != null ) {
+                       sessionFactory.close();
+               }
+       }
+
+       @SuppressWarnings({ "unchecked" })
+       public void testBasicUsage() {
+               // create a couple of events...
+               Session session = sessionFactory.openSession();
+               session.beginTransaction();
+               session.save( new Event( "Our very first event!", new Date() ) );
+               session.save( new Event( "A follow up event", new Date() ) );
+               session.getTransaction().commit();
+               session.close();
+
+               // now lets pull events from the database and list them
+               session = sessionFactory.openSession();
+        session.beginTransaction();
+        List result = session.createQuery( "from Event" ).list();
+               for ( Event event : (List<Event>) result ) {
+                       System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
+               }
+        session.getTransaction().commit();
+        session.close();
+       }
+}
diff --git a/src/it/tutorials-5.2.18/annotations/src/test/java/org/hibernate/tutorial/annotations/Event.java b/src/it/tutorials-5.2.18/annotations/src/test/java/org/hibernate/tutorial/annotations/Event.java
new file mode 100644 (file)
index 0000000..c66349f
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.annotations;
+
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.hibernate.annotations.GenericGenerator;
+
+@Entity
+@Table( name = "EVENTS" )
+public class Event {
+    private Long id;
+
+    private String title;
+    private Date date;
+
+       public Event() {
+               // this form used by Hibernate
+       }
+
+       public Event(String title, Date date) {
+               // for application use, to create new events
+               this.title = title;
+               this.date = date;
+       }
+
+       @Id
+       @GeneratedValue(generator="increment")
+       @GenericGenerator(name="increment", strategy = "increment")
+    public Long getId() {
+               return id;
+    }
+
+    private void setId(Long id) {
+               this.id = id;
+    }
+
+       @Temporal(TemporalType.TIMESTAMP)
+       @Column(name = "EVENT_DATE")
+    public Date getDate() {
+               return date;
+    }
+
+    public void setDate(Date date) {
+               this.date = date;
+    }
+
+    public String getTitle() {
+               return title;
+    }
+
+    public void setTitle(String title) {
+               this.title = title;
+    }
+}
\ No newline at end of file
diff --git a/src/it/tutorials-5.2.18/annotations/src/test/resources/hibernate.cfg.xml b/src/it/tutorials-5.2.18/annotations/src/test/resources/hibernate.cfg.xml
new file mode 100644 (file)
index 0000000..a9590c1
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<!DOCTYPE hibernate-configuration PUBLIC
+        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+
+    <session-factory>
+
+        <!-- Database connection settings -->
+        <property name="connection.driver_class">org.h2.Driver</property>
+        <property name="connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE</property>
+        <property name="connection.username">sa</property>
+        <property name="connection.password"></property>
+
+        <!-- JDBC connection pool (use the built-in) -->
+        <property name="connection.pool_size">1</property>
+
+        <!-- SQL dialect -->
+        <property name="dialect">org.hibernate.dialect.H2Dialect</property>
+
+        <!-- Disable the second-level cache  -->
+        <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
+
+        <!-- Echo all executed SQL to stdout -->
+        <property name="show_sql">true</property>
+
+        <!-- Drop and re-create the database schema on startup -->
+        <property name="hbm2ddl.auto">create</property>
+
+        <!-- Names the annotated entity class -->
+        <mapping class="org.hibernate.tutorial.annotations.Event"/>
+
+    </session-factory>
+
+</hibernate-configuration>
\ No newline at end of file
diff --git a/src/it/tutorials-5.2.18/basic/pom.xml b/src/it/tutorials-5.2.18/basic/pom.xml
new file mode 100644 (file)
index 0000000..783ac6b
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<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>
+
+    <parent>
+        <groupId>org.hibernate.tutorials</groupId>
+        <artifactId>hibernate-tutorials</artifactId>
+        <version>5.2.18.Final</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>hibernate-tutorial-hbm</artifactId>
+    <name>Hibernate hbm.xml Tutorial</name>
+    <description>Hibernate tutorial illustrating the use of native APIs and hbm.xml for mapping metadata</description>
+
+    <properties>
+        <!-- Skip artifact deployment -->
+        <maven.deploy.skip>true</maven.deploy.skip>
+    </properties>
+
+</project>
diff --git a/src/it/tutorials-5.2.18/basic/src/test/java/org/hibernate/tutorial/hbm/Event.hbm.xml b/src/it/tutorials-5.2.18/basic/src/test/java/org/hibernate/tutorial/hbm/Event.hbm.xml
new file mode 100644 (file)
index 0000000..f786e79
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<!DOCTYPE hibernate-mapping PUBLIC
+        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.tutorial.hbm">
+
+    <class name="Event" table="EVENTS">
+        <id name="id" column="EVENT_ID">
+            <generator class="increment"/>
+        </id>
+        <property name="date" type="timestamp" column="EVENT_DATE"/>
+        <property name="title"/>
+    </class>
+
+</hibernate-mapping>
diff --git a/src/it/tutorials-5.2.18/basic/src/test/java/org/hibernate/tutorial/hbm/Event.java b/src/it/tutorials-5.2.18/basic/src/test/java/org/hibernate/tutorial/hbm/Event.java
new file mode 100644 (file)
index 0000000..ae4c2df
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.hbm;
+
+import java.util.Date;
+
+public class Event {
+       private Long id;
+
+       private String title;
+       private Date date;
+
+       public Event() {
+               // this form used by Hibernate
+       }
+
+       public Event(String title, Date date) {
+               // for application use, to create new events
+               this.title = title;
+               this.date = date;
+       }
+
+       public Long getId() {
+               return id;
+       }
+
+       private void setId(Long id) {
+               this.id = id;
+       }
+
+       public Date getDate() {
+               return date;
+       }
+
+       public void setDate(Date date) {
+               this.date = date;
+       }
+
+       public String getTitle() {
+               return title;
+       }
+
+       public void setTitle(String title) {
+               this.title = title;
+       }
+}
\ No newline at end of file
diff --git a/src/it/tutorials-5.2.18/basic/src/test/java/org/hibernate/tutorial/hbm/NativeApiIllustrationTest.java b/src/it/tutorials-5.2.18/basic/src/test/java/org/hibernate/tutorial/hbm/NativeApiIllustrationTest.java
new file mode 100644 (file)
index 0000000..8ee5d08
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.hbm;
+
+import java.util.Date;
+import java.util.List;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.boot.MetadataSources;
+import org.hibernate.boot.registry.StandardServiceRegistry;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+
+import junit.framework.TestCase;
+
+/**
+ * Illustrates use of Hibernate native APIs.
+ *
+ * @author Steve Ebersole
+ */
+public class NativeApiIllustrationTest extends TestCase {
+       private SessionFactory sessionFactory;
+
+       @Override
+       protected void setUp() throws Exception {
+               // A SessionFactory is set up once for an application!
+               final StandardServiceRegistry registry = new StandardServiceRegistryBuilder()
+                               .configure() // configures settings from hibernate.cfg.xml
+                               .build();
+               try {
+                       sessionFactory = new MetadataSources( registry ).buildMetadata().buildSessionFactory();
+               }
+               catch (Exception e) {
+                       // The registry would be destroyed by the SessionFactory, but we had trouble building the SessionFactory
+                       // so destroy it manually.
+                       StandardServiceRegistryBuilder.destroy( registry );
+               }
+       }
+
+       @Override
+       protected void tearDown() throws Exception {
+               if ( sessionFactory != null ) {
+                       sessionFactory.close();
+               }
+       }
+
+       @SuppressWarnings("unchecked")
+       public void testBasicUsage() {
+               // create a couple of events...
+               Session session = sessionFactory.openSession();
+               session.beginTransaction();
+               session.save( new Event( "Our very first event!", new Date() ) );
+               session.save( new Event( "A follow up event", new Date() ) );
+               session.getTransaction().commit();
+               session.close();
+
+               // now lets pull events from the database and list them
+               session = sessionFactory.openSession();
+               session.beginTransaction();
+               List result = session.createQuery( "from Event" ).list();
+               for ( Event event : (List<Event>) result ) {
+                       System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
+               }
+               session.getTransaction().commit();
+               session.close();
+       }
+}
diff --git a/src/it/tutorials-5.2.18/basic/src/test/resources/hibernate.cfg.xml b/src/it/tutorials-5.2.18/basic/src/test/resources/hibernate.cfg.xml
new file mode 100644 (file)
index 0000000..03d3937
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<!DOCTYPE hibernate-configuration PUBLIC
+        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+
+    <session-factory>
+
+        <!-- Database connection settings -->
+        <property name="connection.driver_class">org.h2.Driver</property>
+        <property name="connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE</property>
+        <property name="connection.username">sa</property>
+        <property name="connection.password"/>
+
+        <!-- JDBC connection pool (use the built-in) -->
+        <property name="connection.pool_size">1</property>
+
+        <!-- SQL dialect -->
+        <property name="dialect">org.hibernate.dialect.H2Dialect</property>
+
+        <!-- Disable the second-level cache  -->
+        <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
+
+        <!-- Echo all executed SQL to stdout -->
+        <property name="show_sql">true</property>
+
+        <!-- Drop and re-create the database schema on startup -->
+        <property name="hbm2ddl.auto">create</property>
+
+        <mapping resource="org/hibernate/tutorial/hbm/Event.hbm.xml"/>
+
+    </session-factory>
+
+</hibernate-configuration>
\ No newline at end of file
diff --git a/src/it/tutorials-5.2.18/entitymanager/pom.xml b/src/it/tutorials-5.2.18/entitymanager/pom.xml
new file mode 100644 (file)
index 0000000..d928fb6
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<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>
+
+    <parent>
+        <groupId>org.hibernate.tutorials</groupId>
+        <artifactId>hibernate-tutorials</artifactId>
+        <version>5.2.18.Final</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>hibernate-tutorial-entitymanager</artifactId>
+    <name>Hibernate JPA Tutorial</name>
+    <description>Hibernate tutorial illustrating the use of JPA APIs and annotations for mapping metadata</description>
+
+    <properties>
+        <!-- Skip artifact deployment -->
+        <maven.deploy.skip>true</maven.deploy.skip>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-core</artifactId>
+            <version>5.2.18.Final</version>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/src/it/tutorials-5.2.18/entitymanager/src/test/java/org/hibernate/tutorial/em/EntityManagerIllustrationTest.java b/src/it/tutorials-5.2.18/entitymanager/src/test/java/org/hibernate/tutorial/em/EntityManagerIllustrationTest.java
new file mode 100644 (file)
index 0000000..feebd89
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.em;
+
+import java.util.Date;
+import java.util.List;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import junit.framework.TestCase;
+
+/**
+ * Illustrates basic use of Hibernate as a JPA provider.
+ *
+ * @author Steve Ebersole
+ */
+public class EntityManagerIllustrationTest extends TestCase {
+       private EntityManagerFactory entityManagerFactory;
+
+       @Override
+       protected void setUp() throws Exception {
+               // like discussed with regards to SessionFactory, an EntityManagerFactory is set up once for an application
+               //              IMPORTANT: notice how the name here matches the name we gave the persistence-unit in persistence.xml!
+               entityManagerFactory = Persistence.createEntityManagerFactory( "org.hibernate.tutorial.jpa" );
+       }
+
+       @Override
+       protected void tearDown() throws Exception {
+               entityManagerFactory.close();
+       }
+
+       public void testBasicUsage() {
+               // create a couple of events...
+               EntityManager entityManager = entityManagerFactory.createEntityManager();
+               entityManager.getTransaction().begin();
+               entityManager.persist( new Event( "Our very first event!", new Date() ) );
+               entityManager.persist( new Event( "A follow up event", new Date() ) );
+               entityManager.getTransaction().commit();
+               entityManager.close();
+
+               // now lets pull events from the database and list them
+               entityManager = entityManagerFactory.createEntityManager();
+               entityManager.getTransaction().begin();
+        List<Event> result = entityManager.createQuery( "from Event", Event.class ).getResultList();
+               for ( Event event : result ) {
+                       System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
+               }
+        entityManager.getTransaction().commit();
+        entityManager.close();
+       }
+}
diff --git a/src/it/tutorials-5.2.18/entitymanager/src/test/java/org/hibernate/tutorial/em/Event.java b/src/it/tutorials-5.2.18/entitymanager/src/test/java/org/hibernate/tutorial/em/Event.java
new file mode 100644 (file)
index 0000000..90fe414
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.em;
+
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.hibernate.annotations.GenericGenerator;
+
+@Entity
+@Table( name = "EVENTS" )
+public class Event {
+    private Long id;
+
+    private String title;
+    private Date date;
+
+       public Event() {
+               // this form used by Hibernate
+       }
+
+       public Event(String title, Date date) {
+               // for application use, to create new events
+               this.title = title;
+               this.date = date;
+       }
+
+       @Id
+       @GeneratedValue(generator="increment")
+       @GenericGenerator(name="increment", strategy = "increment")
+    public Long getId() {
+               return id;
+    }
+
+    private void setId(Long id) {
+               this.id = id;
+    }
+
+       @Temporal(TemporalType.TIMESTAMP)
+       @Column(name = "EVENT_DATE")
+    public Date getDate() {
+               return date;
+    }
+
+    public void setDate(Date date) {
+               this.date = date;
+    }
+
+    public String getTitle() {
+               return title;
+    }
+
+    public void setTitle(String title) {
+               this.title = title;
+    }
+}
\ No newline at end of file
diff --git a/src/it/tutorials-5.2.18/entitymanager/src/test/resources/META-INF/persistence.xml b/src/it/tutorials-5.2.18/entitymanager/src/test/resources/META-INF/persistence.xml
new file mode 100644 (file)
index 0000000..0fc9523
--- /dev/null
@@ -0,0 +1,31 @@
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<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="org.hibernate.tutorial.jpa">
+        <description>
+            Persistence unit for the JPA tutorial of the Hibernate Getting Started Guide
+        </description>
+
+        <class>org.hibernate.tutorial.em.Event</class>
+
+        <properties>
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE" />
+            <property name="javax.persistence.jdbc.user" value="sa" />
+            <property name="javax.persistence.jdbc.password" value="" />
+
+            <property name="hibernate.show_sql" value="true" />
+            <property name="hibernate.hbm2ddl.auto" value="create" />
+        </properties>
+
+    </persistence-unit>
+
+</persistence>
diff --git a/src/it/tutorials-5.2.18/envers/pom.xml b/src/it/tutorials-5.2.18/envers/pom.xml
new file mode 100644 (file)
index 0000000..7fa8a48
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<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>
+
+    <parent>
+        <groupId>org.hibernate.tutorials</groupId>
+        <artifactId>hibernate-tutorials</artifactId>
+        <version>5.2.18.Final</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>hibernate-tutorial-envers</artifactId>
+    <name>Hibernate Envers Tutorial</name>
+    <description>Hibernate tutorial illustrating basic set up and use of Envers</description>
+
+    <properties>
+        <!-- Skip artifact deployment -->
+        <maven.deploy.skip>true</maven.deploy.skip>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-envers</artifactId>
+            <version>5.2.18.Final</version>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/src/it/tutorials-5.2.18/envers/src/test/java/org/hibernate/tutorial/envers/EnversIllustrationTest.java b/src/it/tutorials-5.2.18/envers/src/test/java/org/hibernate/tutorial/envers/EnversIllustrationTest.java
new file mode 100644 (file)
index 0000000..5e29faa
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.envers;
+
+import java.util.Date;
+import java.util.List;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import junit.framework.TestCase;
+
+import org.hibernate.envers.AuditReader;
+import org.hibernate.envers.AuditReaderFactory;
+
+/**
+ * Illustrates the set up and use of Envers.
+ * <p>
+ * This example is different from the others in that we really need to save multiple revisions to the entity in
+ * order to get a good look at Envers in action.
+ *
+ * @author Steve Ebersole
+ */
+public class EnversIllustrationTest extends TestCase {
+       private EntityManagerFactory entityManagerFactory;
+
+       @Override
+       protected void setUp() throws Exception {
+               // like discussed with regards to SessionFactory, an EntityManagerFactory is set up once for an application
+               //              IMPORTANT: notice how the name here matches the name we gave the persistence-unit in persistence.xml!
+               entityManagerFactory = Persistence.createEntityManagerFactory( "org.hibernate.tutorial.envers" );
+       }
+
+       @Override
+       protected void tearDown() throws Exception {
+               entityManagerFactory.close();
+       }
+
+       public void testBasicUsage() {
+               // create a couple of events
+               EntityManager entityManager = entityManagerFactory.createEntityManager();
+               entityManager.getTransaction().begin();
+               entityManager.persist( new Event( "Our very first event!", new Date() ) );
+               entityManager.persist( new Event( "A follow up event", new Date() ) );
+               entityManager.getTransaction().commit();
+               entityManager.close();
+
+               // now lets pull events from the database and list them
+               entityManager = entityManagerFactory.createEntityManager();
+               entityManager.getTransaction().begin();
+        List<Event> result = entityManager.createQuery( "from Event", Event.class ).getResultList();
+               for ( Event event : result ) {
+                       System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
+               }
+        entityManager.getTransaction().commit();
+        entityManager.close();
+
+               // so far the code is the same as we have seen in previous tutorials.  Now lets leverage Envers...
+
+               // first lets create some revisions
+               entityManager = entityManagerFactory.createEntityManager();
+               entityManager.getTransaction().begin();
+               Event myEvent = entityManager.find( Event.class, 2L ); // we are using the increment generator, so we know 2 is a valid id
+               myEvent.setDate( new Date() );
+               myEvent.setTitle( myEvent.getTitle() + " (rescheduled)" );
+        entityManager.getTransaction().commit();
+        entityManager.close();
+
+               // and then use an AuditReader to look back through history
+               entityManager = entityManagerFactory.createEntityManager();
+               entityManager.getTransaction().begin();
+               myEvent = entityManager.find( Event.class, 2L );
+               assertEquals( "A follow up event (rescheduled)", myEvent.getTitle() );
+               AuditReader reader = AuditReaderFactory.get( entityManager );
+               Event firstRevision = reader.find( Event.class, 2L, 1 );
+               assertFalse( firstRevision.getTitle().equals( myEvent.getTitle() ) );
+               assertFalse( firstRevision.getDate().equals( myEvent.getDate() ) );
+               Event secondRevision = reader.find( Event.class, 2L, 2 );
+               assertTrue( secondRevision.getTitle().equals( myEvent.getTitle() ) );
+               assertTrue( secondRevision.getDate().equals( myEvent.getDate() ) );
+               entityManager.getTransaction().commit();
+        entityManager.close();
+       }
+}
diff --git a/src/it/tutorials-5.2.18/envers/src/test/java/org/hibernate/tutorial/envers/Event.java b/src/it/tutorials-5.2.18/envers/src/test/java/org/hibernate/tutorial/envers/Event.java
new file mode 100644 (file)
index 0000000..64741a6
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.tutorial.envers;
+
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.hibernate.annotations.GenericGenerator;
+import org.hibernate.envers.Audited;
+
+@Entity
+@Table( name = "EVENTS" )
+@Audited  // <--- this tell Envers to audit (track changes to) this entity
+public class Event {
+    private Long id;
+
+    private String title;
+    private Date date;
+
+       public Event() {
+               // this form used by Hibernate
+       }
+
+       public Event(String title, Date date) {
+               // for application use, to create new events
+               this.title = title;
+               this.date = date;
+       }
+
+       @Id
+       @GeneratedValue(generator="increment")
+       @GenericGenerator(name="increment", strategy = "increment")
+    public Long getId() {
+               return id;
+    }
+
+    private void setId(Long id) {
+               this.id = id;
+    }
+
+       @Temporal(TemporalType.TIMESTAMP)
+       @Column(name = "EVENT_DATE")
+    public Date getDate() {
+               return date;
+    }
+
+    public void setDate(Date date) {
+               this.date = date;
+    }
+
+    public String getTitle() {
+               return title;
+    }
+
+    public void setTitle(String title) {
+               this.title = title;
+    }
+
+       @Override
+       public int hashCode() {
+               int result = title.hashCode();
+               result = 31 * result + date.hashCode();
+               return result;
+       }
+}
\ No newline at end of file
diff --git a/src/it/tutorials-5.2.18/envers/src/test/resources/META-INF/persistence.xml b/src/it/tutorials-5.2.18/envers/src/test/resources/META-INF/persistence.xml
new file mode 100644 (file)
index 0000000..45a7daf
--- /dev/null
@@ -0,0 +1,31 @@
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<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="org.hibernate.tutorial.envers">
+        <description>
+            Persistence unit for the Envers tutorial of the Hibernate Getting Started Guide
+        </description>
+
+        <class>org.hibernate.tutorial.envers.Event</class>
+
+        <properties>
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE" />
+            <property name="javax.persistence.jdbc.user" value="sa" />
+            <property name="javax.persistence.jdbc.password" value="" />
+
+            <property name="hibernate.show_sql" value="true" />
+            <property name="hibernate.hbm2ddl.auto" value="create" />
+        </properties>
+
+    </persistence-unit>
+
+</persistence>
diff --git a/src/it/tutorials-5.2.18/osgi/datasource-h2.xml b/src/it/tutorials-5.2.18/osgi/datasource-h2.xml
new file mode 100644 (file)
index 0000000..3bf738f
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+
+<!--
+First install the H2 driver using:
+> install -s mvn:com.h2database/h2/1.3.163
+
+Then copy this file to the deploy folder
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+  
+  <bean id="dataSource" class="org.h2.jdbcx.JdbcDataSource">
+      <property name="URL" value="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE"/>
+      <property name="user" value="sa"/>
+      <property name="password" value=""/>
+  </bean>
+  
+  <service interface="javax.sql.DataSource" ref="dataSource">
+    <service-properties>
+            <entry key="osgi.jndi.service.name" value="jdbc/h2ds"/>
+    </service-properties>
+  </service>
+</blueprint>
diff --git a/src/it/tutorials-5.2.18/osgi/managed-jpa/features.xml b/src/it/tutorials-5.2.18/osgi/managed-jpa/features.xml
new file mode 100644 (file)
index 0000000..b2d48ed
--- /dev/null
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<features>
+  <feature name="hibernate-test">
+
+    <!-- JTA -->
+    <config name="org.apache.aries.transaction">
+      aries.transaction.recoverable = true
+      aries.transaction.timeout = 600
+      aries.transaction.howl.logFileDir = /tmp/karaf/txlog
+      aries.transaction.howl.maxLogFiles = 2
+      aries.transaction.howl.maxBlocksPerFile = 512
+      aries.transaction.howl.bufferSizeKBytes = 4
+    </config>
+    <bundle dependency="true" start-level="30">mvn:org.jboss.spec.javax.transaction/jboss-transaction-api_1.2_spec/1.0.1.Final</bundle>
+    <bundle start-level="30">mvn:org.apache.aries.transaction/org.apache.aries.transaction.blueprint/1.0.0</bundle>
+    <bundle start-level="30">mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/1.0.1</bundle>
+
+    <!-- JPA -->
+    <bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
+    <!-- No container currently supports JPA 2.1.  Clone and build Aries from the following fork (upgrades to
+         JPA 2.1).  Aries should be upgrading as soon as the spec is out.
+         https://github.com/brmeyer/aries/tree/jpa21 -->
+    <bundle start-level="30">mvn:org.apache.aries/org.apache.aries.util/1.1.1-SNAPSHOT</bundle>
+    <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/1.0.1-SNAPSHOT</bundle>
+    <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint.aries/1.0.2-SNAPSHOT</bundle>
+    <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/1.0.1-SNAPSHOT</bundle>
+    <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container.context/1.0.2-SNAPSHOT</bundle>
+
+    <!-- JNDI -->
+    <bundle start-level="30">mvn:org.apache.aries/org.apache.aries.util/1.0.0</bundle>
+    <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.api/1.0.0</bundle>
+    <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.core/1.0.0</bundle>
+    <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.rmi/1.0.0</bundle>
+    <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.url/1.0.0</bundle>
+    <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.legacy.support/1.0.0</bundle>
+
+    <!-- Taken from Karaf-Tutorial -->
+    <bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
+    <bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
+    <bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
+    <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
+    <bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
+
+    <bundle>mvn:com.h2database/h2/1.3.170</bundle>
+    <bundle>blueprint:file:/[PATH]/datasource-h2.xml</bundle>
+
+    <!-- These do not natively support OSGi, so using 3rd party bundles. -->
+    <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
+    <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
+
+    <!-- These do not natively support OSGi, so wrap with BND. -->
+    <bundle>wrap:mvn:org.jboss/jandex/1.1.0.Final</bundle>
+
+    <bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
+    <bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
+    <bundle>mvn:log4j/log4j/1.2.17</bundle>
+    <bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
+    <bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
+
+    <bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.5.Final</bundle>
+
+    <bundle>mvn:org.hibernate/hibernate-core/5.2.18.Final</bundle>
+
+    <!-- TODO: It seems that the persistence unit bundle needs to be started
+    before hibernate-osgi.  When the BundleActivator is started,
+    the persistence unit is provided even though managed-jpa
+    hasn't completely started yet.  If that happens, you'll get an "illegal
+    bundle state" exception.  Is there a way for the activator to
+    watch for bundles with PUs before registering the persistence provider? -->
+    <bundle>mvn:org.hibernate.osgi/managed-jpa/1.0.0</bundle>
+
+    <bundle>mvn:org.hibernate/hibernate-osgi/5.2.18.Final</bundle>
+  </feature>
+</features>
diff --git a/src/it/tutorials-5.2.18/osgi/managed-jpa/pom.xml b/src/it/tutorials-5.2.18/osgi/managed-jpa/pom.xml
new file mode 100644 (file)
index 0000000..55ccacd
--- /dev/null
@@ -0,0 +1,70 @@
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.hibernate.osgi</groupId>
+  <artifactId>managed-jpa</artifactId>
+  <version>1.0.0</version>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.hibernate.javax.persistence</groupId>
+      <artifactId>hibernate-jpa-2.1-api</artifactId>
+      <version>1.0.0.Final</version>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>4.3.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.enterprise</artifactId>
+      <version>4.2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.karaf.shell</groupId>
+      <artifactId>org.apache.karaf.shell.console</artifactId>
+      <version>2.3.0</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>org.hibernate.osgi.managed-jpa</Bundle-SymbolicName>
+            <Bundle-Name>managed-jpa</Bundle-Name>
+            <Bundle-Version>1.0.0</Bundle-Version>
+            <Export-Package>
+              org.hibernate.osgitest,
+              org.hibernate.osgitest.entity
+            </Export-Package>
+            <Import-Package>
+              org.apache.felix.service.command,
+              org.apache.felix.gogo.commands,
+              org.apache.karaf.shell.console,
+              org.apache.karaf.shell.commands,
+              javax.persistence;version="[1.0.0,2.1.0]",
+              <!-- Needed for proxying's Javassist enhancement during runtime -->
+              org.hibernate.proxy,
+              javassist.util.proxy,
+              *
+            </Import-Package>
+            <Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java b/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java
new file mode 100644 (file)
index 0000000..bdeaace
--- /dev/null
@@ -0,0 +1,37 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.List;
+
+import org.hibernate.osgitest.entity.DataPoint;
+
+/**
+ * @author Brett Meyer
+ */
+public interface DataPointService {
+
+       public void add(DataPoint dp);
+
+       public List<DataPoint> getAll();
+
+       public void deleteAll();
+}
diff --git a/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java b/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java
new file mode 100644 (file)
index 0000000..f324889
--- /dev/null
@@ -0,0 +1,58 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.hibernate.osgitest.entity.DataPoint;
+
+/**
+ * @author Brett Meyer
+ */
+public class DataPointServiceImpl implements DataPointService {
+
+       private EntityManager entityManager;
+
+       public void add(DataPoint dp) {
+               entityManager.persist( dp );
+               entityManager.flush();
+       }
+
+       public List<DataPoint> getAll() {
+               return entityManager.createQuery( "select d from DataPoint d", DataPoint.class ).getResultList();
+       }
+
+       public void deleteAll() {
+               entityManager.createQuery( "delete from DataPoint" ).executeUpdate();
+               entityManager.flush();
+       }
+
+       public EntityManager getEntityManager() {
+               return entityManager;
+       }
+
+       public void setEntityManager(EntityManager entityManager) {
+               this.entityManager = entityManager;
+       }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java b/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java
new file mode 100644 (file)
index 0000000..9e9844c
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "add")
+public class AddCommand implements Action {
+    @Argument(index=0, name="Name", required=true, description="Name", multiValued=false)
+    String name;
+    
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        DataPoint dp = new DataPoint();
+        dp.setName( name );
+        dpService.add( dp );
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java b/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java
new file mode 100644 (file)
index 0000000..d6c4ccf
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+
+@Command(scope = "dp", name = "deleteAll")
+public class DeleteAllCommand implements Action {
+private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+       dpService.deleteAll();
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java b/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java
new file mode 100644 (file)
index 0000000..ebdac60
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import java.util.List;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "getAll")
+public class GetAllCommand implements Action {
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        List<DataPoint> dps = dpService.getAll();
+        for (DataPoint dp : dps) {
+            System.out.println(dp.getId() + ", " + dp.getName());
+        }
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java b/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java
new file mode 100644 (file)
index 0000000..2a566d8
--- /dev/null
@@ -0,0 +1,53 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Brett Meyer
+ */
+@Entity
+public class DataPoint {
+       @Id
+       @GeneratedValue
+       private long id;
+       
+       private String 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;
+       }
+}
diff --git a/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/resources/META-INF/persistence.xml b/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/resources/META-INF/persistence.xml
new file mode 100644 (file)
index 0000000..77555cb
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    version="1.0">
+    <persistence-unit name="managed-jpa" transaction-type="JTA">
+        <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/h2ds)</jta-data-source>
+        
+        <properties>
+            <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
+            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
+            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+            <property name="hibernate.archive.autodetection" value="class"/>
+        </properties>
+    </persistence-unit>
+</persistence>
\ No newline at end of file
diff --git a/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/src/it/tutorials-5.2.18/osgi/managed-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644 (file)
index 0000000..2436aa7
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<blueprint default-activation="eager"
+           xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0"
+           xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0">
+
+  <!-- This gets the container-managed EntityManager and injects it into the DataPointServiceImpl bean. -->
+  <bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl">
+    <jpa:context unitname="managed-jpa" property="entityManager"/>
+    <tx:transaction method="*" value="Required"/>
+  </bean>
+  <service ref="dpService" interface="org.hibernate.osgitest.DataPointService"/>
+
+  <!-- This demonstrates how to register your custom implementations of Hibernate extension points, such as
+       Integrator and TypeContributor. -->
+  <!-- <bean id="integrator" class="your.package.IntegratorImpl"/>
+  <service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
+  <bean id="typeContributor" class="your.package.TypeContributorImpl"/>
+  <service ref="typeContributor" interface="org.hibernate.metamodel.spi.TypeContributor"/> -->
+
+  <!-- This bundle makes use of Karaf commands to demonstrate core persistence operations.  Feel free to remove it. -->
+  <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+    <command>
+      <action class="org.hibernate.osgitest.command.AddCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+    <command>
+      <action class="org.hibernate.osgitest.command.GetAllCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+    <command>
+      <action class="org.hibernate.osgitest.command.DeleteAllCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+  </command-bundle>
+</blueprint>
diff --git a/src/it/tutorials-5.2.18/osgi/pom.xml b/src/it/tutorials-5.2.18/osgi/pom.xml
new file mode 100644 (file)
index 0000000..b017b3e
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<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>
+
+    <parent>
+        <groupId>org.hibernate.tutorials</groupId>
+        <artifactId>hibernate-tutorials</artifactId>
+        <version>5.2.18.Final</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>hibernate-tutorial-osgi</artifactId>
+    <name>Hibernate OSGI Tutorials</name>
+    <description>Hibernate tutoriasl illustrating basic set up and use of OSGI</description>
+    <packaging>pom</packaging>
+
+    <properties>
+        <!-- Skip artifact deployment -->
+        <maven.deploy.skip>true</maven.deploy.skip>
+    </properties>
+
+    <modules>
+        <module>managed-jpa</module>
+        <module>unmanaged-jpa</module>
+        <module>unmanaged-native</module>
+    </modules>
+
+</project>
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/features.xml b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/features.xml
new file mode 100644 (file)
index 0000000..784140a
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<features>
+  <feature name="hibernate-test">
+
+    <!-- JTA -->
+    <bundle start-level="30">mvn:org.jboss.spec.javax.transaction/jboss-transaction-api_1.2_spec/1.0.1.Final</bundle>
+
+    <!-- JPA -->
+    <bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
+
+    <!-- Taken from Karaf-Tutorial -->
+    <bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
+    <bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
+    <bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
+    <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
+    <bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
+
+    <bundle>mvn:com.h2database/h2/1.3.170</bundle>
+
+    <!-- These do not natively support OSGi, so using 3rd party bundles. -->
+    <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
+    <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
+
+    <!-- These do not natively support OSGi, so wrap with BND. -->
+    <bundle>wrap:mvn:org.jboss/jandex/1.1.0.Final</bundle>
+
+    <bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
+    <bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
+    <bundle>mvn:log4j/log4j/1.2.17</bundle>
+    <bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
+    <bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
+
+    <bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.5.Final</bundle>
+
+    <bundle>mvn:org.hibernate/hibernate-core/5.2.18.Final</bundle>
+    <bundle>mvn:org.hibernate/hibernate-osgi/5.2.18.Final</bundle>
+
+    <bundle>mvn:org.hibernate.osgi/unmanaged-jpa/1.0.0</bundle>
+  </feature>
+</features>
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/pom.xml b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/pom.xml
new file mode 100644 (file)
index 0000000..e45aab5
--- /dev/null
@@ -0,0 +1,81 @@
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.hibernate.osgi</groupId>
+  <artifactId>unmanaged-jpa</artifactId>
+  <version>1.0.0</version>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.hibernate.javax.persistence</groupId>
+      <artifactId>hibernate-jpa-2.1-api</artifactId>
+      <version>1.0.0.Final</version>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>4.3.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.enterprise</artifactId>
+      <version>4.2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.karaf.shell</groupId>
+      <artifactId>org.apache.karaf.shell.console</artifactId>
+      <version>2.3.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.hibernate</groupId>
+      <artifactId>hibernate-core</artifactId>
+      <version>5.2.18.Final</version>
+    </dependency>
+    <dependency>
+      <groupId>com.h2database</groupId>
+      <artifactId>h2</artifactId>
+      <version>1.3.170</version>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>org.hibernate.osgi.unmanaged-jpa</Bundle-SymbolicName>
+            <Bundle-Name>unmanaged-jpa</Bundle-Name>
+            <Bundle-Version>1.0.0</Bundle-Version>
+            <Export-Package>
+              org.hibernate.osgitest,
+              org.hibernate.osgitest.entity
+            </Export-Package>
+            <Import-Package>
+              org.apache.felix.service.command,
+              org.apache.felix.gogo.commands,
+              org.apache.karaf.shell.console,
+              org.apache.karaf.shell.commands,
+              org.h2,
+              javax.persistence;version="[1.0.0,2.1.0]",
+              <!-- Needed for proxying's Javassist enhancement during runtime -->
+              org.hibernate.proxy,
+              javassist.util.proxy,
+              *
+            </Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java
new file mode 100644 (file)
index 0000000..de8c960
--- /dev/null
@@ -0,0 +1,41 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.List;
+
+import org.hibernate.osgitest.entity.DataPoint;
+
+/**
+ * @author Brett Meyer
+ */
+public interface DataPointService {
+
+       public void add(DataPoint dp);
+
+       public void update(DataPoint dp);
+
+       public DataPoint get(long id);
+
+       public List<DataPoint> getAll();
+
+       public void deleteAll();
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java
new file mode 100644 (file)
index 0000000..dba3609
--- /dev/null
@@ -0,0 +1,78 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.hibernate.osgitest.entity.DataPoint;
+
+/**
+ * @author Brett Meyer
+ */
+public class DataPointServiceImpl implements DataPointService {
+       
+       private HibernateUtil hibernateUtil = new HibernateUtil();
+
+       public void add(DataPoint dp) {
+               EntityManager em = hibernateUtil.getEntityManager();
+               em.getTransaction().begin();
+               em.persist( dp );
+               em.getTransaction().commit();
+               em.close();
+       }
+
+       public void update(DataPoint dp) {
+               EntityManager em = hibernateUtil.getEntityManager();
+               em.getTransaction().begin();
+               em.merge( dp );
+               em.getTransaction().commit();
+               em.close();
+       }
+
+       public DataPoint get(long id) {
+               EntityManager em = hibernateUtil.getEntityManager();
+               em.getTransaction().begin();
+               DataPoint dp = (DataPoint) em.createQuery( "from DataPoint dp where dp.id=" + id ).getSingleResult();
+               em.getTransaction().commit();
+               em.close();
+               return dp;
+       }
+
+       public List<DataPoint> getAll() {
+               EntityManager em = hibernateUtil.getEntityManager();
+               em.getTransaction().begin();
+               List list = em.createQuery( "from DataPoint" ).getResultList();
+               em.getTransaction().commit();
+               em.close();
+               return list;
+       }
+
+       public void deleteAll() {
+               EntityManager em = hibernateUtil.getEntityManager();
+               em.getTransaction().begin();
+               em.createQuery( "delete from DataPoint" ).executeUpdate();
+               em.getTransaction().commit();
+               em.close();
+       }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/HibernateUtil.java b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/HibernateUtil.java
new file mode 100644 (file)
index 0000000..0927f15
--- /dev/null
@@ -0,0 +1,57 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.spi.PersistenceProvider;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * @author Brett Meyer
+ */
+
+public class HibernateUtil {
+
+       private EntityManagerFactory emf;
+
+       public EntityManager getEntityManager() {
+               return getEntityManagerFactory().createEntityManager();
+       }
+
+       private EntityManagerFactory getEntityManagerFactory() {
+               if ( emf == null ) {
+                       Bundle thisBundle = FrameworkUtil.getBundle( HibernateUtil.class );
+                       // Could get this by wiring up OsgiTestBundleActivator as well.
+                       BundleContext context = thisBundle.getBundleContext();
+
+                       ServiceReference serviceReference = context.getServiceReference( PersistenceProvider.class.getName() );
+                       PersistenceProvider persistenceProvider = (PersistenceProvider) context.getService( serviceReference );
+
+                       emf = persistenceProvider.createEntityManagerFactory( "unmanaged-jpa", null );
+               }
+               return emf;
+       }
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestIntegrator.java b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestIntegrator.java
new file mode 100644 (file)
index 0000000..f443634
--- /dev/null
@@ -0,0 +1,45 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import org.hibernate.boot.Metadata;
+import org.hibernate.engine.spi.SessionFactoryImplementor;
+import org.hibernate.integrator.spi.Integrator;
+import org.hibernate.service.spi.SessionFactoryServiceRegistry;
+
+
+/**
+ * @author Brett Meyer
+ */
+public class TestIntegrator implements Integrator {
+
+    public void integrate(
+            Metadata metadata,
+            SessionFactoryImplementor sessionFactory,
+            SessionFactoryServiceRegistry serviceRegistry) {
+        System.out.println("Integrator#integrate");
+    }
+
+    public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
+        System.out.println("Integrator#disintegrate");
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java
new file mode 100644 (file)
index 0000000..f7ad26f
--- /dev/null
@@ -0,0 +1,37 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.Collections;
+
+import org.hibernate.boot.registry.selector.StrategyRegistration;
+import org.hibernate.boot.registry.selector.StrategyRegistrationProvider;
+
+/**
+ * @author Brett Meyer
+ */
+public class TestStrategyRegistrationProvider implements StrategyRegistrationProvider {
+
+       public Iterable<StrategyRegistration> getStrategyRegistrations() {
+               System.out.println("StrategyRegistrationProvider#getStrategyRegistrations");
+               return Collections.EMPTY_LIST;
+       }
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestTypeContributor.java b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestTypeContributor.java
new file mode 100644 (file)
index 0000000..0da11cb
--- /dev/null
@@ -0,0 +1,37 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import org.hibernate.boot.model.TypeContributions;
+import org.hibernate.boot.model.TypeContributor;
+import org.hibernate.service.ServiceRegistry;
+
+
+/**
+ * @author Brett Meyer
+ */
+public class TestTypeContributor implements TypeContributor {
+
+    public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
+        System.out.println("TypeContributor#contribute");
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java
new file mode 100644 (file)
index 0000000..c1b906c
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "addJPA")
+public class AddCommand implements Action {
+    @Argument(index=0, name="Name", required=true, description="Name", multiValued=false)
+    String name;
+    
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        DataPoint dp = new DataPoint();
+        dp.setName( name );
+        dpService.add( dp );
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java
new file mode 100644 (file)
index 0000000..0d404ae
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+
+@Command(scope = "dp", name = "deleteAllJPA")
+public class DeleteAllCommand implements Action {
+private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+       dpService.deleteAll();
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java
new file mode 100644 (file)
index 0000000..6873e46
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import java.util.List;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "getAllJPA")
+public class GetAllCommand implements Action {
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        List<DataPoint> dps = dpService.getAll();
+        for (DataPoint dp : dps) {
+            System.out.println(dp.getId() + ", " + dp.getName());
+        }
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java
new file mode 100644 (file)
index 0000000..5de8983
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "updateJPA")
+public class UpdateCommand implements Action {
+    @Argument(index=0, name="Id", required=true, description="Id", multiValued=false)
+    String id;
+    
+    @Argument(index=1, name="Name", required=true, description="Name", multiValued=false)
+    String name;
+    
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        DataPoint dp = dpService.get( Long.valueOf( id ) );
+        dp.setName( name );
+        dpService.update( dp );
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java
new file mode 100644 (file)
index 0000000..2a566d8
--- /dev/null
@@ -0,0 +1,53 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Brett Meyer
+ */
+@Entity
+public class DataPoint {
+       @Id
+       @GeneratedValue
+       private long id;
+       
+       private String 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;
+       }
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/resources/META-INF/persistence.xml b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/resources/META-INF/persistence.xml
new file mode 100644 (file)
index 0000000..b0ebfe7
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    version="1.0">
+    <persistence-unit name="unmanaged-jpa">
+        <class>org.hibernate.osgitest.entity.DataPoint</class>
+        <exclude-unlisted-classes>true</exclude-unlisted-classes>
+        
+        <properties>
+            <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
+            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
+            <property name="hibernate.connection.url" value="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE"/>
+            <property name="hibernate.connection.username" value="sa"/>
+            <property name="hibernate.connection.password" value=""/>
+            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+        </properties>
+    </persistence-unit>
+</persistence>
\ No newline at end of file
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/src/it/tutorials-5.2.18/osgi/unmanaged-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644 (file)
index 0000000..283ee10
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<blueprint default-activation="eager"
+           xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+  <bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl"/>
+  <service ref="dpService" interface="org.hibernate.osgitest.DataPointService"/>
+
+  <!-- This demonstrates how to register your custom implementations of Hibernate extension points. -->
+
+  <bean id="integrator" class="org.hibernate.osgitest.TestIntegrator"/>
+  <service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
+
+  <bean id="strategyRegistrationProvider" class="org.hibernate.osgitest.TestStrategyRegistrationProvider"/>
+  <service ref="strategyRegistrationProvider"
+           interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
+
+  <bean id="typeContributor" class="org.hibernate.osgitest.TestTypeContributor"/>
+  <service ref="typeContributor" interface="org.hibernate.boot.model.TypeContributor"/>
+
+  <!-- This bundle makes use of Karaf commands to demonstrate core persistence operations.  Feel free to remove it. -->
+  <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+    <command>
+      <action class="org.hibernate.osgitest.command.AddCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+    <command>
+      <action class="org.hibernate.osgitest.command.UpdateCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+    <command>
+      <action class="org.hibernate.osgitest.command.GetAllCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+    <command>
+      <action class="org.hibernate.osgitest.command.DeleteAllCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+  </command-bundle>
+</blueprint>
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/features.xml b/src/it/tutorials-5.2.18/osgi/unmanaged-native/features.xml
new file mode 100644 (file)
index 0000000..f3b2b2d
--- /dev/null
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<features>
+  <feature name="hibernate-test">
+
+    <!--<feature>karaf-framework</feature>-->
+
+    <!-- JTA -->
+    <bundle start-level="30">mvn:org.jboss.spec.javax.transaction/jboss-transaction-api_1.2_spec/1.0.1.Final</bundle>
+
+    <!-- JPA -->
+    <bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
+
+    <!-- Taken from Karaf-Tutorial -->
+    <bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
+    <bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
+    <bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
+    <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
+    <bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
+
+    <bundle>mvn:com.h2database/h2/1.3.170</bundle>
+
+    <!-- These do not natively support OSGi, so using 3rd party bundles. -->
+    <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
+    <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
+
+    <!-- These do not natively support OSGi, so wrap with BND. -->
+    <bundle>wrap:mvn:org.jboss/jandex/1.1.0.Final</bundle>
+    <!-- Optional.  Needed to test C3P0 connection pools. -->
+    <!-- <bundle>wrap:mvn:c3p0/c3p0/0.9.1</bundle> -->
+    <!-- Optional.  Needed to test Proxool connection pools. -->
+    <!-- <bundle>wrap:mvn:proxool/proxool/0.8.3</bundle> -->
+    <!-- Optional.  Needed to test ehcache 2lc. -->
+    <!-- <bundle>wrap:mvn:net.sf.ehcache/ehcache-core/2.4.3</bundle> -->
+
+    <bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
+    <bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
+    <bundle>mvn:log4j/log4j/1.2.17</bundle>
+    <bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
+    <bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
+
+    <bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.5.Final</bundle>
+
+    <!-- JACC is optional. -->
+    <!--<bundle>mvn:javax.servlet/javax.servlet-api/3.0.1</bundle>
+    <bundle>mvn:org.jboss.spec.javax.security.jacc/jboss-jacc-api_1.4_spec/1.0.2.Final</bundle>-->
+
+    <!-- hibernate-validator is optional. -->
+    <!--<bundle>wrap:mvn:javax.validation/validation-api/1.0.0.GA</bundle>
+    <bundle>mvn:org.hibernate/hibernate-validator/4.2.0.Final</bundle>-->
+
+    <!-- Optional.  Needed to test infinispan 2lc. -->
+    <!-- IMPORTANT: Infinispan requires the JRE sun.misc package.  You
+    MUST enable this in your OSGi container.  For Karaf, add
+    "org.osgi.framework.system.packages.extra=sun.misc" to etc/config.properties -->
+    <!-- <bundle>wrap:mvn:org.jboss.marshalling/jboss-marshalling/1.3.17.GA</bundle>
+    <bundle>wrap:mvn:org.jboss.marshalling/jboss-marshalling-river/1.3.17.GA</bundle>
+    <bundle>wrap:mvn:org.jboss/staxmapper/1.1.0.Final</bundle>
+    <bundle>mvn:org.jgroups/jgroups/3.2.8.Final</bundle>
+    <bundle>mvn:org.infinispan/infinispan-core/5.2.0.Beta3</bundle> -->
+
+    <bundle>mvn:org.hibernate/hibernate-core/5.2.18.Final</bundle>
+    <!-- TODO: Shouldn't need this, but hibernate-osgi's activator is a catch-all for SF and EMF. -->
+    <bundle>mvn:org.hibernate/hibernate-envers/5.2.18.Final</bundle>
+    <!-- <bundle>mvn:org.hibernate/hibernate-c3p0/5.2.18.Final</bundle> -->
+    <!-- <bundle>mvn:org.hibernate/hibernate-proxool/5.2.18.Final</bundle> -->
+    <!-- <bundle>mvn:org.hibernate/hibernate-ehcache/5.2.18.Final</bundle> -->
+    <!-- <bundle>mvn:org.hibernate/hibernate-infinispan/5.2.18.Final</bundle> -->
+    <bundle>mvn:org.hibernate/hibernate-osgi/5.2.18.Final</bundle>
+
+    <bundle>mvn:org.hibernate.osgi/unmanaged-native/1.0.0</bundle>
+  </feature>
+</features>
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/pom.xml b/src/it/tutorials-5.2.18/osgi/unmanaged-native/pom.xml
new file mode 100644 (file)
index 0000000..d24f03d
--- /dev/null
@@ -0,0 +1,89 @@
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.hibernate.osgi</groupId>
+  <artifactId>unmanaged-native</artifactId>
+  <version>1.0.0</version>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.hibernate.javax.persistence</groupId>
+      <artifactId>hibernate-jpa-2.1-api</artifactId>
+      <version>1.0.0.Final</version>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>4.3.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.enterprise</artifactId>
+      <version>4.2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.karaf.shell</groupId>
+      <artifactId>org.apache.karaf.shell.console</artifactId>
+      <version>2.3.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.hibernate</groupId>
+      <artifactId>hibernate-core</artifactId>
+      <version>5.2.18.Final</version>
+    </dependency>
+    <dependency>
+      <groupId>org.hibernate</groupId>
+      <artifactId>hibernate-envers</artifactId>
+      <version>5.2.18.Final</version>
+    </dependency>
+    <dependency>
+      <groupId>com.h2database</groupId>
+      <artifactId>h2</artifactId>
+      <version>1.3.170</version>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>org.hibernate.osgi.unmanaged-native</Bundle-SymbolicName>
+            <Bundle-Name>unmanaged-native</Bundle-Name>
+            <Bundle-Version>1.0.0</Bundle-Version>
+            <Export-Package>
+              org.hibernate.osgitest,
+              org.hibernate.osgitest.entity
+            </Export-Package>
+            <Import-Package>
+              org.apache.felix.service.command,
+              org.apache.felix.gogo.commands,
+              org.apache.karaf.shell.console,
+              org.apache.karaf.shell.commands,
+              org.h2,
+              org.hibernate,
+              org.hibernate.cfg,
+              org.hibernate.service,
+              javax.persistence;version="[1.0.0,2.1.0]",
+              <!-- Needed for proxy enhancement during runtime -->
+              org.hibernate.proxy,
+              javassist.util.proxy,
+              *
+            </Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointService.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointService.java
new file mode 100644 (file)
index 0000000..12fb79a
--- /dev/null
@@ -0,0 +1,47 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.List;
+import java.util.Map;
+
+import org.hibernate.envers.DefaultRevisionEntity;
+import org.hibernate.osgitest.entity.DataPoint;
+
+/**
+ * @author Brett Meyer
+ */
+public interface DataPointService {
+
+       public void add(DataPoint dp);
+
+       public void update(DataPoint dp);
+
+       public DataPoint get(long id);
+
+       public DataPoint load(long id);
+
+       public List<DataPoint> getAll();
+
+       public Map<Number, DefaultRevisionEntity> getRevisions(long id);
+
+       public void deleteAll();
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java
new file mode 100644 (file)
index 0000000..a8f6f72
--- /dev/null
@@ -0,0 +1,103 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import org.hibernate.Session;
+import org.hibernate.criterion.Restrictions;
+import org.hibernate.envers.AuditReader;
+import org.hibernate.envers.AuditReaderFactory;
+import org.hibernate.envers.DefaultRevisionEntity;
+import org.hibernate.osgitest.entity.DataPoint;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Brett Meyer
+ */
+public class DataPointServiceImpl implements DataPointService {
+       
+       private HibernateUtil hibernateUtil = new HibernateUtil();
+
+       public void add(DataPoint dp) {
+               Session s = hibernateUtil.getSession();
+               s.getTransaction().begin();
+               s.persist( dp );
+               s.getTransaction().commit();
+               s.close();
+       }
+
+       public void update(DataPoint dp) {
+               Session s = hibernateUtil.getSession();
+               s.getTransaction().begin();
+               s.update( dp );
+               s.getTransaction().commit();
+               s.close();
+       }
+
+       public DataPoint get(long id) {
+               Session s = hibernateUtil.getSession();
+               s.getTransaction().begin();
+               DataPoint dp = (DataPoint) s.createCriteria( DataPoint.class ).add(
+                               Restrictions.eq( "id", id ) ).uniqueResult();
+               s.getTransaction().commit();
+               s.close();
+               return dp;
+       }
+
+       // Test lazy loading (mainly to make sure the proxy classes work in OSGi)
+       public DataPoint load(long id) {
+               Session s = hibernateUtil.getSession();
+               s.getTransaction().begin();
+               DataPoint dp = (DataPoint) s.load( DataPoint.class, new Long(id) );
+               // initialize
+               dp.getName();
+               s.getTransaction().commit();
+               s.close();
+               return dp;
+       }
+
+       public List<DataPoint> getAll() {
+               Session s = hibernateUtil.getSession();
+               s.getTransaction().begin();
+               List list = s.createQuery( "from DataPoint" ).list();
+               s.getTransaction().commit();
+               s.close();
+               return list;
+       }
+       
+       public Map<Number, DefaultRevisionEntity> getRevisions(long id) {
+               Session s = hibernateUtil.getSession();
+               AuditReader reader = AuditReaderFactory.get(s);
+               List<Number> revisionNums = reader.getRevisions( DataPoint.class, id );
+               return reader.findRevisions( DefaultRevisionEntity.class, new HashSet<Number>(revisionNums) );
+       }
+
+       public void deleteAll() {
+               Session s = hibernateUtil.getSession();
+               s.getTransaction().begin();
+               s.createQuery( "delete from DataPoint" ).executeUpdate();
+               s.getTransaction().commit();
+               s.close();
+       }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/HibernateUtil.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/HibernateUtil.java
new file mode 100644 (file)
index 0000000..15fb4c7
--- /dev/null
@@ -0,0 +1,53 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * @author Brett Meyer
+ */
+
+public class HibernateUtil {
+
+       private SessionFactory sf;
+
+       public Session getSession() {
+               return getSessionFactory().openSession();
+       }
+
+       private SessionFactory getSessionFactory() {
+               if ( sf == null ) {
+                       Bundle thisBundle = FrameworkUtil.getBundle( HibernateUtil.class );
+                       // Could get this by wiring up OsgiTestBundleActivator as well.
+                       BundleContext context = thisBundle.getBundleContext();
+
+                       ServiceReference sr = context.getServiceReference( SessionFactory.class.getName() );
+                       sf = (SessionFactory) context.getService( sr );
+               }
+               return sf;
+       }
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestIntegrator.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestIntegrator.java
new file mode 100644 (file)
index 0000000..95b2e63
--- /dev/null
@@ -0,0 +1,45 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import org.hibernate.boot.Metadata;
+import org.hibernate.engine.spi.SessionFactoryImplementor;
+import org.hibernate.integrator.spi.Integrator;
+import org.hibernate.service.spi.SessionFactoryServiceRegistry;
+
+
+/**
+ * @author Brett Meyer
+ */
+public class TestIntegrator implements Integrator {
+
+       public void integrate(
+            Metadata metadata,
+            SessionFactoryImplementor sessionFactory,
+            SessionFactoryServiceRegistry serviceRegistry) {
+        System.out.println("Integrator#integrate");
+    }
+
+    public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
+        System.out.println("Integrator#disintegrate");
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java
new file mode 100644 (file)
index 0000000..f7ad26f
--- /dev/null
@@ -0,0 +1,37 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import java.util.Collections;
+
+import org.hibernate.boot.registry.selector.StrategyRegistration;
+import org.hibernate.boot.registry.selector.StrategyRegistrationProvider;
+
+/**
+ * @author Brett Meyer
+ */
+public class TestStrategyRegistrationProvider implements StrategyRegistrationProvider {
+
+       public Iterable<StrategyRegistration> getStrategyRegistrations() {
+               System.out.println("StrategyRegistrationProvider#getStrategyRegistrations");
+               return Collections.EMPTY_LIST;
+       }
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestTypeContributor.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestTypeContributor.java
new file mode 100644 (file)
index 0000000..87a8384
--- /dev/null
@@ -0,0 +1,37 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest;
+
+import org.hibernate.boot.model.TypeContributions;
+import org.hibernate.boot.model.TypeContributor;
+import org.hibernate.service.ServiceRegistry;
+
+
+/**
+ * @author Brett Meyer
+ */
+public class TestTypeContributor implements TypeContributor {
+
+       public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
+               System.out.println("TypeContributor#contribute");
+       }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/AddCommand.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/AddCommand.java
new file mode 100644 (file)
index 0000000..9e9844c
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "add")
+public class AddCommand implements Action {
+    @Argument(index=0, name="Name", required=true, description="Name", multiValued=false)
+    String name;
+    
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        DataPoint dp = new DataPoint();
+        dp.setName( name );
+        dpService.add( dp );
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java
new file mode 100644 (file)
index 0000000..d6c4ccf
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+
+@Command(scope = "dp", name = "deleteAll")
+public class DeleteAllCommand implements Action {
+private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+       dpService.deleteAll();
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java
new file mode 100644 (file)
index 0000000..ebdac60
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import java.util.List;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "getAll")
+public class GetAllCommand implements Action {
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        List<DataPoint> dps = dpService.getAll();
+        for (DataPoint dp : dps) {
+            System.out.println(dp.getId() + ", " + dp.getName());
+        }
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetCommand.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetCommand.java
new file mode 100644 (file)
index 0000000..0597d70
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "get")
+public class GetCommand implements Action {
+       @Argument(index = 0, name = "Id", required = true, description = "Id", multiValued = false)
+       String id;
+
+       private DataPointService dpService;
+
+       public void setDpService(DataPointService dpService) {
+               this.dpService = dpService;
+       }
+
+       public Object execute(CommandSession session) throws Exception {
+               DataPoint dp = dpService.get( Long.valueOf( id ) );
+               System.out.println( dp.getId() + ", " + dp.getName() );
+               return null;
+       }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetRevisionsCommand.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetRevisionsCommand.java
new file mode 100644 (file)
index 0000000..b4573f6
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import java.util.Map;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.envers.DefaultRevisionEntity;
+import org.hibernate.osgitest.DataPointService;
+
+@Command(scope = "dp", name = "getRevisions")
+public class GetRevisionsCommand implements Action {
+       @Argument(index=0, name="Id", required=true, description="Id", multiValued=false)
+    String id;
+       
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+       Map<Number, DefaultRevisionEntity> revisions = dpService.getRevisions(Long.valueOf( id ));
+        for (Number revisionNum : revisions.keySet()) {
+               DefaultRevisionEntity dre = revisions.get( revisionNum );
+            System.out.println(revisionNum + ": " + dre.getId() + ", " + dre.getTimestamp());
+        }
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/LoadCommand.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/LoadCommand.java
new file mode 100644 (file)
index 0000000..3451a98
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "load")
+public class LoadCommand implements Action {
+       @Argument(index = 0, name = "Id", required = true, description = "Id", multiValued = false)
+       String id;
+
+       private DataPointService dpService;
+
+       public void setDpService(DataPointService dpService) {
+               this.dpService = dpService;
+       }
+
+       public Object execute(CommandSession session) throws Exception {
+               DataPoint dp = dpService.load( Long.valueOf( id ) );
+               System.out.println( dp.getId() + ", " + dp.getName() );
+               return null;
+       }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java
new file mode 100644 (file)
index 0000000..f694967
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.osgitest.command;
+
+import org.apache.felix.gogo.commands.Action;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.service.command.CommandSession;
+import org.hibernate.osgitest.DataPointService;
+import org.hibernate.osgitest.entity.DataPoint;
+
+@Command(scope = "dp", name = "update")
+public class UpdateCommand implements Action {
+    @Argument(index=0, name="Id", required=true, description="Id", multiValued=false)
+    String id;
+    
+    @Argument(index=1, name="Name", required=true, description="Name", multiValued=false)
+    String name;
+    
+    private DataPointService dpService;
+    
+    public void setDpService(DataPointService dpService) {
+        this.dpService = dpService;
+    }
+
+    public Object execute(CommandSession session) throws Exception {
+        DataPoint dp = dpService.get( Long.valueOf( id ) );
+        dp.setName( name );
+        dpService.update( dp );
+        return null;
+    }
+
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/entity/DataPoint.java b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/entity/DataPoint.java
new file mode 100644 (file)
index 0000000..2e5ef72
--- /dev/null
@@ -0,0 +1,58 @@
+/* 
+ * Hibernate, Relational Persistence for Idiomatic Java
+ * 
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.hibernate.osgitest.entity;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Brett Meyer
+ */
+@Entity
+@Audited
+public class DataPoint implements Serializable {
+       @Id
+       @GeneratedValue
+       private long id;
+       
+       private String 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;
+       }
+}
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644 (file)
index 0000000..f62626a
--- /dev/null
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<blueprint default-activation="eager"
+           xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+        >
+
+  <bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl"/>
+  <service ref="dpService" interface="org.hibernate.osgitest.DataPointService"/>
+
+  <!-- This demonstrates how to register your custom implementations of Hibernate extension points. -->
+
+  <bean id="integrator" class="org.hibernate.osgitest.TestIntegrator"/>
+  <service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
+
+  <bean id="strategyRegistrationProvider" class="org.hibernate.osgitest.TestStrategyRegistrationProvider"/>
+  <service ref="strategyRegistrationProvider"
+           interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
+
+  <bean id="typeContributor" class="org.hibernate.osgitest.TestTypeContributor"/>
+  <service ref="typeContributor" interface="org.hibernate.boot.model.TypeContributor"/>
+
+  <!-- This bundle makes use of Karaf commands to demonstrate core persistence operations.  Feel free to remove it. -->
+  <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+    <command>
+      <action class="org.hibernate.osgitest.command.AddCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+    <command>
+      <action class="org.hibernate.osgitest.command.UpdateCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+    <command>
+      <action class="org.hibernate.osgitest.command.GetCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+    <command>
+      <action class="org.hibernate.osgitest.command.LoadCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+    <command>
+      <action class="org.hibernate.osgitest.command.GetAllCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+    <command>
+      <action class="org.hibernate.osgitest.command.GetRevisionsCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+    <command>
+      <action class="org.hibernate.osgitest.command.DeleteAllCommand">
+        <property name="dpService" ref="dpService"/>
+      </action>
+    </command>
+  </command-bundle>
+</blueprint>
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/resources/ehcache.xml b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/resources/ehcache.xml
new file mode 100644 (file)
index 0000000..52d198d
--- /dev/null
@@ -0,0 +1,94 @@
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<ehcache>
+
+    <!-- Sets the path to the directory where cache .data files are created.
+
+         If the path is a Java System Property it is replaced by
+         its value in the running VM.
+
+         The following properties are translated:
+         user.home - User's home directory
+         user.dir - User's current working directory
+         java.io.tmpdir - Default temp file path -->
+    <diskStore path="./target/tmp"/>
+
+
+    <!--Default Cache configuration. These will applied to caches programmatically created through
+        the CacheManager.
+
+        The following attributes are required for defaultCache:
+
+        maxInMemory       - Sets the maximum number of objects that will be created in memory
+        eternal           - Sets whether elements are eternal. If eternal,  timeouts are ignored and the element
+                            is never expired.
+        timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
+                            if the element is not eternal. Idle time is now - last accessed time
+        timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
+                            if the element is not eternal. TTL is now - creation time
+        overflowToDisk    - Sets whether elements can overflow to disk when the in-memory cache
+                            has reached the maxInMemory limit.
+
+        -->
+    <defaultCache
+        maxElementsInMemory="10000"
+        eternal="false"
+        timeToIdleSeconds="120"
+        timeToLiveSeconds="120"
+        overflowToDisk="true"
+        />
+
+    <!--Predefined caches.  Add your cache configuration settings here.
+        If you do not have a configuration for your cache a WARNING will be issued when the
+        CacheManager starts
+
+        The following attributes are required for defaultCache:
+
+        name              - Sets the name of the cache. This is used to identify the cache. It must be unique.
+        maxInMemory       - Sets the maximum number of objects that will be created in memory
+        eternal           - Sets whether elements are eternal. If eternal,  timeouts are ignored and the element
+                            is never expired.
+        timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
+                            if the element is not eternal. Idle time is now - last accessed time
+        timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
+                            if the element is not eternal. TTL is now - creation time
+        overflowToDisk    - Sets whether elements can overflow to disk when the in-memory cache
+                            has reached the maxInMemory limit.
+
+        -->
+
+    <!-- Sample cache named sampleCache1
+        This cache contains a maximum in memory of 10000 elements, and will expire
+        an element if it is idle for more than 5 minutes and lives for more than
+        10 minutes.
+
+        If there are more than 10000 elements it will overflow to the
+        disk cache, which in this configuration will go to wherever java.io.tmp is
+        defined on your system. On a standard Linux system this will be /tmp"
+        -->
+    <cache name="sampleCache1"
+        maxElementsInMemory="10000"
+        eternal="false"
+        timeToIdleSeconds="300"
+        timeToLiveSeconds="600"
+        overflowToDisk="true"
+        />
+
+    <!-- Sample cache named sampleCache2
+        This cache contains 1000 elements. Elements will always be held in memory.
+        They are not expired. -->
+    <cache name="sampleCache2"
+        maxElementsInMemory="1000"
+        eternal="true"
+        timeToIdleSeconds="0"
+        timeToLiveSeconds="0"
+        overflowToDisk="false"
+        /> -->
+
+    <!-- Place configuration for your caches following -->
+
+</ehcache>
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/resources/hibernate.cfg.xml b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/resources/hibernate.cfg.xml
new file mode 100644 (file)
index 0000000..7f9f238
--- /dev/null
@@ -0,0 +1,52 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<!DOCTYPE hibernate-configuration PUBLIC
+"-//Hibernate/Hibernate Configuration DTD//EN"
+"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+    <session-factory>
+        <property name="hibernate.connection.driver_class">org.h2.Driver</property>
+        <property name="hibernate.connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE</property>
+        <property name="hibernate.connection.username">sa</property>
+        <property name="hibernate.connection.password"></property>
+        <property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
+        <property name="hibernate.hbm2ddl.auto">create-drop</property>
+        
+        <!-- <property name="hibernate.connection.pool_size">5</property>
+               <property name="hibernate.c3p0.min_size">50</property>
+               <property name="hibernate.c3p0.max_size">800</property>
+               <property name="hibernate.c3p0.max_statements">50</property>
+               <property name="hibernate.jdbc.batch_size">10</property>
+               <property name="hibernate.c3p0.timeout">300</property>
+               <property name="hibernate.c3p0.idle_test_period">3000</property>
+               <property name="hibernate.c3p0.testConnectionOnCheckout">true</property> -->
+               
+               <!-- <property name="hibernate.connection.pool_size">5</property>
+               <property name="hibernate.jdbc.batch_size">10</property>
+               <property name="hibernate.connection.provider_class">proxool</property>
+               <property name="hibernate.proxool.properties">pool-one.properties</property>
+               <property name="hibernate.proxool.pool_alias">pool-one</property> -->
+               
+               <!-- <property name="hibernate.cache.region_prefix">hibernate.test</property>
+               <property name="cache.use_query_cache">true</property>
+        <property name="cache.use_second_level_cache">true</property>
+        <property name="cache.use_structured_entries">true</property>
+        <property name="cache.region.factory_class">org.hibernate.cache.EhCacheRegionFactory</property>
+        <property name="net.sf.ehcache.configurationResourceName">file:///[PATH]/unmanaged-jpa/src/main/resources/ehcache.xml</property> -->
+    
+        <!-- <property name="hibernate.cache.region_prefix">hibernate.test</property>
+               <property name="cache.use_query_cache">true</property>
+        <property name="cache.use_second_level_cache">true</property>
+        <property name="cache.use_structured_entries">true</property>
+        <property name="cache.region.factory_class">org.hibernate.cache.infinispan.InfinispanRegionFactory</property> -->
+        
+        <mapping class="org.hibernate.osgitest.entity.DataPoint"/>
+    </session-factory>
+</hibernate-configuration>
diff --git a/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/resources/pool-one.properties b/src/it/tutorials-5.2.18/osgi/unmanaged-native/src/main/resources/pool-one.properties
new file mode 100644 (file)
index 0000000..7e1c4cf
--- /dev/null
@@ -0,0 +1,13 @@
+#
+# Hibernate, Relational Persistence for Idiomatic Java
+#
+# License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+#
+jdbc-0.proxool.alias=pool-one
+jdbc-0.proxool.driver-url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE
+jdbc-0.proxool.driver-class=org.h2.Driver
+jdbc-0.user=sa
+jdbc-0.password=
+jdbc-0.proxool.maximum-connection-count=2
+jdbc-0.proxool.house-keeping-test-sql=select CURRENT_DATE
\ No newline at end of file
diff --git a/src/it/tutorials-5.2.18/pom.xml b/src/it/tutorials-5.2.18/pom.xml
new file mode 100644 (file)
index 0000000..26d0f89
--- /dev/null
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.hibernate.tutorials</groupId>
+    <artifactId>hibernate-tutorials</artifactId>
+    <version>5.2.18.Final</version>
+    <packaging>pom</packaging>
+
+    <name>Hibernate Getting Started Guide Tutorials</name>
+    <description>Aggregator for the Hibernate tutorials presented in the Getting Started Guide</description>
+
+    <properties>
+        <!-- Skip artifact deployment -->
+        <maven.deploy.skip>true</maven.deploy.skip>
+    </properties>
+
+    <modules>
+        <module>basic</module>
+        <module>annotations</module>
+        <module>entitymanager</module>
+        <module>envers</module>
+        <module>osgi</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-core</artifactId>
+            <version>5.2.18.Final</version>
+        </dependency>
+
+        <!-- Hibernate uses jboss-logging for logging, for the tutorials we will use the sl4fj-simple backend -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <version>1.7.5</version>
+        </dependency>
+
+        <!-- The tutorials use JUnit test cases to illustrate usage -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+        </dependency>
+
+        <!-- The tutorials use the H2 in-memory database -->
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <version>1.4.196</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <testResources>
+            <testResource>
+                <filtering>false</filtering>
+                <directory>src/test/java</directory>
+                <includes>
+                    <include>**/*.xml</include>
+                </includes>
+            </testResource>
+            <testResource>
+                <directory>src/test/resources</directory>
+            </testResource>
+        </testResources>
+    </build>
+
+</project>
diff --git a/src/it/tutorials/annotations/pom.xml b/src/it/tutorials/annotations/pom.xml
deleted file mode 100644 (file)
index 86982ad..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<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>
-
-    <parent>
-        <groupId>org.hibernate.tutorials</groupId>
-        <artifactId>hibernate-tutorials</artifactId>
-        <version>4.3.9.Final</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>hibernate-tutorial-annotations</artifactId>
-    <name>Hibernate Annotations Tutorial</name>
-    <description>Hibernate tutorial illustrating the use of native APIs and annotations for mapping metadata</description>
-
-    <properties>
-        <!-- Skip artifact deployment -->
-        <maven.deploy.skip>true</maven.deploy.skip>
-        <h4mp.version>@project.version@</h4mp.version>
-    </properties>
-
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>de.juplo</groupId>
-                <artifactId>hibernate-maven-plugin</artifactId>
-                <version>${h4mp.version}</version>
-                <executions>
-                    <execution>
-                        <phase>process-test-classes</phase>
-                        <goals>
-                            <goal>create</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <configuration>
-                    <scanTestClasses>true</scanTestClasses>
-                    <format>true</format>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
diff --git a/src/it/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/AnnotationsIllustrationTest.java b/src/it/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/AnnotationsIllustrationTest.java
deleted file mode 100644 (file)
index c1131d2..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors.  All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA  02110-1301  USA
- */
-package org.hibernate.tutorial.annotations;
-
-import java.util.Date;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.cfg.Configuration;
-
-/**
- * Illustrates the use of Hibernate native APIs.  The code here is unchanged from the {@code basic} example, the
- * only difference being the use of annotations to supply the metadata instead of Hibernate mapping files.
- *
- * @author Steve Ebersole
- */
-public class AnnotationsIllustrationTest extends TestCase {
-       private SessionFactory sessionFactory;
-
-       @Override
-       protected void setUp() throws Exception {
-               // A SessionFactory is set up once for an application
-        sessionFactory = new Configuration()
-                .configure() // configures settings from hibernate.cfg.xml
-                .buildSessionFactory();
-       }
-
-       @Override
-       protected void tearDown() throws Exception {
-               if ( sessionFactory != null ) {
-                       sessionFactory.close();
-               }
-       }
-
-       @SuppressWarnings({ "unchecked" })
-       public void testBasicUsage() {
-               // create a couple of events...
-               Session session = sessionFactory.openSession();
-               session.beginTransaction();
-               session.save( new Event( "Our very first event!", new Date() ) );
-               session.save( new Event( "A follow up event", new Date() ) );
-               session.getTransaction().commit();
-               session.close();
-
-               // now lets pull events from the database and list them
-               session = sessionFactory.openSession();
-        session.beginTransaction();
-        List result = session.createQuery( "from Event" ).list();
-               for ( Event event : (List<Event>) result ) {
-                       System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
-               }
-        session.getTransaction().commit();
-        session.close();
-       }
-}
diff --git a/src/it/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/Event.java b/src/it/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/Event.java
deleted file mode 100644 (file)
index c66349f..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors.  All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA  02110-1301  USA
- */
-package org.hibernate.tutorial.annotations;
-
-import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import org.hibernate.annotations.GenericGenerator;
-
-@Entity
-@Table( name = "EVENTS" )
-public class Event {
-    private Long id;
-
-    private String title;
-    private Date date;
-
-       public Event() {
-               // this form used by Hibernate
-       }
-
-       public Event(String title, Date date) {
-               // for application use, to create new events
-               this.title = title;
-               this.date = date;
-       }
-
-       @Id
-       @GeneratedValue(generator="increment")
-       @GenericGenerator(name="increment", strategy = "increment")
-    public Long getId() {
-               return id;
-    }
-
-    private void setId(Long id) {
-               this.id = id;
-    }
-
-       @Temporal(TemporalType.TIMESTAMP)
-       @Column(name = "EVENT_DATE")
-    public Date getDate() {
-               return date;
-    }
-
-    public void setDate(Date date) {
-               this.date = date;
-    }
-
-    public String getTitle() {
-               return title;
-    }
-
-    public void setTitle(String title) {
-               this.title = title;
-    }
-}
\ No newline at end of file
diff --git a/src/it/tutorials/annotations/src/test/resources/hibernate.cfg.xml b/src/it/tutorials/annotations/src/test/resources/hibernate.cfg.xml
deleted file mode 100644 (file)
index d9ae1f5..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<!DOCTYPE hibernate-configuration PUBLIC
-        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
-        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
-
-<hibernate-configuration>
-
-    <session-factory>
-
-        <!-- Database connection settings -->
-        <property name="connection.driver_class">org.h2.Driver</property>
-        <property name="connection.url">jdbc:h2:${project.build.directory}/db/test;MVCC=TRUE</property>
-        <property name="connection.username">sa</property>
-        <property name="connection.password"></property>
-
-        <!-- JDBC connection pool (use the built-in) -->
-        <property name="connection.pool_size">1</property>
-
-        <!-- SQL dialect -->
-        <property name="dialect">org.hibernate.dialect.H2Dialect</property>
-
-        <!-- Disable the second-level cache  -->
-        <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
-
-        <!-- Echo all executed SQL to stdout -->
-        <property name="show_sql">true</property>
-
-        <!-- Names the annotated entity class -->
-        <mapping class="org.hibernate.tutorial.annotations.Event"/>
-
-    </session-factory>
-
-</hibernate-configuration>
\ No newline at end of file
diff --git a/src/it/tutorials/basic/pom.xml b/src/it/tutorials/basic/pom.xml
deleted file mode 100644 (file)
index 64ecf12..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<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>
-
-    <parent>
-        <groupId>org.hibernate.tutorials</groupId>
-        <artifactId>hibernate-tutorials</artifactId>
-        <version>4.3.9.Final</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>hibernate-tutorial-hbm</artifactId>
-    <name>Hibernate hbm.xml Tutorial</name>
-    <description>Hibernate tutorial illustrating the use of native APIs and hbm.xml for mapping metadata</description>
-
-    <properties>
-        <!-- Skip artifact deployment -->
-        <maven.deploy.skip>true</maven.deploy.skip>
-        <h4mp.version>@project.version@</h4mp.version>
-    </properties>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>de.juplo</groupId>
-                <artifactId>hibernate-maven-plugin</artifactId>
-                <version>${h4mp.version}</version>
-                <executions>
-                    <execution>
-                        <phase>process-test-classes</phase>
-                        <goals>
-                            <goal>create</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <configuration>
-                    <scanTestClasses>true</scanTestClasses>
-                    <format>true</format>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
diff --git a/src/it/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.hbm.xml b/src/it/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.hbm.xml
deleted file mode 100644 (file)
index 2b3de75..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-
-<!DOCTYPE hibernate-mapping PUBLIC
-        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
-        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.hibernate.tutorial.hbm">
-
-    <class name="Event" table="EVENTS">
-        <id name="id" column="EVENT_ID">
-            <generator class="increment"/>
-        </id>
-        <property name="date" type="timestamp" column="EVENT_DATE"/>
-        <property name="title"/>
-    </class>
-
-</hibernate-mapping>
diff --git a/src/it/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.java b/src/it/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.java
deleted file mode 100644 (file)
index ae4c2df..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors.  All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA  02110-1301  USA
- */
-package org.hibernate.tutorial.hbm;
-
-import java.util.Date;
-
-public class Event {
-       private Long id;
-
-       private String title;
-       private Date date;
-
-       public Event() {
-               // this form used by Hibernate
-       }
-
-       public Event(String title, Date date) {
-               // for application use, to create new events
-               this.title = title;
-               this.date = date;
-       }
-
-       public Long getId() {
-               return id;
-       }
-
-       private void setId(Long id) {
-               this.id = id;
-       }
-
-       public Date getDate() {
-               return date;
-       }
-
-       public void setDate(Date date) {
-               this.date = date;
-       }
-
-       public String getTitle() {
-               return title;
-       }
-
-       public void setTitle(String title) {
-               this.title = title;
-       }
-}
\ No newline at end of file
diff --git a/src/it/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/NativeApiIllustrationTest.java b/src/it/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/NativeApiIllustrationTest.java
deleted file mode 100644 (file)
index c714f70..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors.  All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA  02110-1301  USA
- */
-package org.hibernate.tutorial.hbm;
-
-import java.util.Date;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.cfg.Configuration;
-
-/**
- * Illustrates use of Hibernate native APIs.
- *
- * @author Steve Ebersole
- */
-public class NativeApiIllustrationTest extends TestCase {
-       private SessionFactory sessionFactory;
-
-       @Override
-       protected void setUp() throws Exception {
-               // A SessionFactory is set up once for an application
-        sessionFactory = new Configuration()
-                .configure() // configures settings from hibernate.cfg.xml
-                .buildSessionFactory();
-       }
-
-       @Override
-       protected void tearDown() throws Exception {
-               if ( sessionFactory != null ) {
-                       sessionFactory.close();
-               }
-       }
-
-       public void testBasicUsage() {
-               // create a couple of events...
-               Session session = sessionFactory.openSession();
-               session.beginTransaction();
-               session.save( new Event( "Our very first event!", new Date() ) );
-               session.save( new Event( "A follow up event", new Date() ) );
-               session.getTransaction().commit();
-               session.close();
-
-               // now lets pull events from the database and list them
-               session = sessionFactory.openSession();
-        session.beginTransaction();
-        List result = session.createQuery( "from Event" ).list();
-               for ( Event event : (List<Event>) result ) {
-                       System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
-               }
-        session.getTransaction().commit();
-        session.close();
-       }
-}
diff --git a/src/it/tutorials/basic/src/test/resources/hibernate.cfg.xml b/src/it/tutorials/basic/src/test/resources/hibernate.cfg.xml
deleted file mode 100644 (file)
index 8144f2d..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<!DOCTYPE hibernate-configuration PUBLIC
-        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
-        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
-
-<hibernate-configuration>
-
-    <session-factory>
-
-        <!-- Database connection settings -->
-        <property name="connection.driver_class">org.h2.Driver</property>
-        <property name="connection.url">jdbc:h2:${project.build.directory}/db/test;MVCC=TRUE</property>
-        <property name="connection.username">sa</property>
-        <property name="connection.password"/>
-
-        <!-- JDBC connection pool (use the built-in) -->
-        <property name="connection.pool_size">1</property>
-
-        <!-- SQL dialect -->
-        <property name="dialect">org.hibernate.dialect.H2Dialect</property>
-
-        <!-- Disable the second-level cache  -->
-        <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
-
-        <!-- Echo all executed SQL to stdout -->
-        <property name="show_sql">true</property>
-
-        <!-- Drop and re-create the database schema on startup -->
-        <property name="hbm2ddl.auto">create</property>
-
-        <mapping resource="org/hibernate/tutorial/hbm/Event.hbm.xml"/>
-
-    </session-factory>
-
-</hibernate-configuration>
\ No newline at end of file
diff --git a/src/it/tutorials/entitymanager/pom.xml b/src/it/tutorials/entitymanager/pom.xml
deleted file mode 100644 (file)
index 9d740a5..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<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>
-
-    <parent>
-        <groupId>org.hibernate.tutorials</groupId>
-        <artifactId>hibernate-tutorials</artifactId>
-        <version>4.3.9.Final</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>hibernate-tutorial-entitymanager</artifactId>
-    <name>Hibernate JPA Tutorial</name>
-    <description>Hibernate tutorial illustrating the use of JPA APIs and annotations for mapping metadata</description>
-
-    <properties>
-        <!-- Skip artifact deployment -->
-        <maven.deploy.skip>true</maven.deploy.skip>
-        <h4mp.version>@project.version@</h4mp.version>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-entitymanager</artifactId>
-            <version>4.3.9.Final</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>de.juplo</groupId>
-                <artifactId>hibernate-maven-plugin</artifactId>
-                <version>${h4mp.version}</version>
-                <executions>
-                    <execution>
-                        <phase>process-test-classes</phase>
-                        <goals>
-                            <goal>create</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <configuration>
-                    <scanTestClasses>true</scanTestClasses>
-                    <dialect>org.hibernate.dialect.H2Dialect</dialect>
-                    <format>true</format>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
diff --git a/src/it/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/EntityManagerIllustrationTest.java b/src/it/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/EntityManagerIllustrationTest.java
deleted file mode 100644 (file)
index feebd89..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors.  All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA  02110-1301  USA
- */
-package org.hibernate.tutorial.em;
-
-import java.util.Date;
-import java.util.List;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-
-import junit.framework.TestCase;
-
-/**
- * Illustrates basic use of Hibernate as a JPA provider.
- *
- * @author Steve Ebersole
- */
-public class EntityManagerIllustrationTest extends TestCase {
-       private EntityManagerFactory entityManagerFactory;
-
-       @Override
-       protected void setUp() throws Exception {
-               // like discussed with regards to SessionFactory, an EntityManagerFactory is set up once for an application
-               //              IMPORTANT: notice how the name here matches the name we gave the persistence-unit in persistence.xml!
-               entityManagerFactory = Persistence.createEntityManagerFactory( "org.hibernate.tutorial.jpa" );
-       }
-
-       @Override
-       protected void tearDown() throws Exception {
-               entityManagerFactory.close();
-       }
-
-       public void testBasicUsage() {
-               // create a couple of events...
-               EntityManager entityManager = entityManagerFactory.createEntityManager();
-               entityManager.getTransaction().begin();
-               entityManager.persist( new Event( "Our very first event!", new Date() ) );
-               entityManager.persist( new Event( "A follow up event", new Date() ) );
-               entityManager.getTransaction().commit();
-               entityManager.close();
-
-               // now lets pull events from the database and list them
-               entityManager = entityManagerFactory.createEntityManager();
-               entityManager.getTransaction().begin();
-        List<Event> result = entityManager.createQuery( "from Event", Event.class ).getResultList();
-               for ( Event event : result ) {
-                       System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
-               }
-        entityManager.getTransaction().commit();
-        entityManager.close();
-       }
-}
diff --git a/src/it/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/Event.java b/src/it/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/Event.java
deleted file mode 100644 (file)
index 90fe414..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors.  All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA  02110-1301  USA
- */
-package org.hibernate.tutorial.em;
-
-import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import org.hibernate.annotations.GenericGenerator;
-
-@Entity
-@Table( name = "EVENTS" )
-public class Event {
-    private Long id;
-
-    private String title;
-    private Date date;
-
-       public Event() {
-               // this form used by Hibernate
-       }
-
-       public Event(String title, Date date) {
-               // for application use, to create new events
-               this.title = title;
-               this.date = date;
-       }
-
-       @Id
-       @GeneratedValue(generator="increment")
-       @GenericGenerator(name="increment", strategy = "increment")
-    public Long getId() {
-               return id;
-    }
-
-    private void setId(Long id) {
-               this.id = id;
-    }
-
-       @Temporal(TemporalType.TIMESTAMP)
-       @Column(name = "EVENT_DATE")
-    public Date getDate() {
-               return date;
-    }
-
-    public void setDate(Date date) {
-               this.date = date;
-    }
-
-    public String getTitle() {
-               return title;
-    }
-
-    public void setTitle(String title) {
-               this.title = title;
-    }
-}
\ No newline at end of file
diff --git a/src/it/tutorials/entitymanager/src/test/resources/META-INF/persistence.xml b/src/it/tutorials/entitymanager/src/test/resources/META-INF/persistence.xml
deleted file mode 100644 (file)
index ac11225..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<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="org.hibernate.tutorial.jpa">
-        <description>
-            Persistence unit for the JPA tutorial of the Hibernate Getting Started Guide
-        </description>
-
-        <class>org.hibernate.tutorial.em.Event</class>
-
-        <properties>
-            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
-            <property name="javax.persistence.jdbc.url" value="jdbc:h2:${project.build.directory}/db/test;MVCC=TRUE" />
-            <property name="javax.persistence.jdbc.user" value="sa" />
-            <property name="javax.persistence.jdbc.password" value="" />
-
-            <property name="hibernate.show_sql" value="true" />
-            <property name="hibernate.hbm2ddl.auto" value="create" />
-        </properties>
-
-    </persistence-unit>
-
-</persistence>
diff --git a/src/it/tutorials/entitymanager/target/create.sql b/src/it/tutorials/entitymanager/target/create.sql
deleted file mode 100644 (file)
index 48eb18e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-    create table EVENTS (
-        id bigint not null,
-        EVENT_DATE timestamp,
-        title varchar(255),
-        primary key (id)
-    );
diff --git a/src/it/tutorials/envers/pom.xml b/src/it/tutorials/envers/pom.xml
deleted file mode 100644 (file)
index f5d8769..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<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>
-
-    <parent>
-        <groupId>org.hibernate.tutorials</groupId>
-        <artifactId>hibernate-tutorials</artifactId>
-        <version>4.3.9.Final</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>hibernate-tutorial-envers</artifactId>
-    <name>Hibernate Envers Tutorial</name>
-    <description>Hibernate tutorial illustrating basic set up and use of Envers</description>
-
-    <properties>
-        <!-- Skip artifact deployment -->
-        <maven.deploy.skip>true</maven.deploy.skip>
-        <h4mp.version>@project.version@</h4mp.version>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-envers</artifactId>
-            <version>4.3.9.Final</version>
-        </dependency>
-        <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-entitymanager</artifactId>
-            <version>4.3.9.Final</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>de.juplo</groupId>
-                <artifactId>hibernate-maven-plugin</artifactId>
-                <version>${h4mp.version}</version>
-                <executions>
-                    <execution>
-                        <phase>process-test-classes</phase>
-                        <goals>
-                            <goal>create</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <configuration>
-                    <scanTestClasses>true</scanTestClasses>
-                    <dialect>org.hibernate.dialect.H2Dialect</dialect>
-                    <format>true</format>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
diff --git a/src/it/tutorials/envers/src/test/java/org/hibernate/tutorial/envers/EnversIllustrationTest.java b/src/it/tutorials/envers/src/test/java/org/hibernate/tutorial/envers/EnversIllustrationTest.java
deleted file mode 100644 (file)
index 5e29faa..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors.  All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA  02110-1301  USA
- */
-package org.hibernate.tutorial.envers;
-
-import java.util.Date;
-import java.util.List;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-
-import junit.framework.TestCase;
-
-import org.hibernate.envers.AuditReader;
-import org.hibernate.envers.AuditReaderFactory;
-
-/**
- * Illustrates the set up and use of Envers.
- * <p>
- * This example is different from the others in that we really need to save multiple revisions to the entity in
- * order to get a good look at Envers in action.
- *
- * @author Steve Ebersole
- */
-public class EnversIllustrationTest extends TestCase {
-       private EntityManagerFactory entityManagerFactory;
-
-       @Override
-       protected void setUp() throws Exception {
-               // like discussed with regards to SessionFactory, an EntityManagerFactory is set up once for an application
-               //              IMPORTANT: notice how the name here matches the name we gave the persistence-unit in persistence.xml!
-               entityManagerFactory = Persistence.createEntityManagerFactory( "org.hibernate.tutorial.envers" );
-       }
-
-       @Override
-       protected void tearDown() throws Exception {
-               entityManagerFactory.close();
-       }
-
-       public void testBasicUsage() {
-               // create a couple of events
-               EntityManager entityManager = entityManagerFactory.createEntityManager();
-               entityManager.getTransaction().begin();
-               entityManager.persist( new Event( "Our very first event!", new Date() ) );
-               entityManager.persist( new Event( "A follow up event", new Date() ) );
-               entityManager.getTransaction().commit();
-               entityManager.close();
-
-               // now lets pull events from the database and list them
-               entityManager = entityManagerFactory.createEntityManager();
-               entityManager.getTransaction().begin();
-        List<Event> result = entityManager.createQuery( "from Event", Event.class ).getResultList();
-               for ( Event event : result ) {
-                       System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
-               }
-        entityManager.getTransaction().commit();
-        entityManager.close();
-
-               // so far the code is the same as we have seen in previous tutorials.  Now lets leverage Envers...
-
-               // first lets create some revisions
-               entityManager = entityManagerFactory.createEntityManager();
-               entityManager.getTransaction().begin();
-               Event myEvent = entityManager.find( Event.class, 2L ); // we are using the increment generator, so we know 2 is a valid id
-               myEvent.setDate( new Date() );
-               myEvent.setTitle( myEvent.getTitle() + " (rescheduled)" );
-        entityManager.getTransaction().commit();
-        entityManager.close();
-
-               // and then use an AuditReader to look back through history
-               entityManager = entityManagerFactory.createEntityManager();
-               entityManager.getTransaction().begin();
-               myEvent = entityManager.find( Event.class, 2L );
-               assertEquals( "A follow up event (rescheduled)", myEvent.getTitle() );
-               AuditReader reader = AuditReaderFactory.get( entityManager );
-               Event firstRevision = reader.find( Event.class, 2L, 1 );
-               assertFalse( firstRevision.getTitle().equals( myEvent.getTitle() ) );
-               assertFalse( firstRevision.getDate().equals( myEvent.getDate() ) );
-               Event secondRevision = reader.find( Event.class, 2L, 2 );
-               assertTrue( secondRevision.getTitle().equals( myEvent.getTitle() ) );
-               assertTrue( secondRevision.getDate().equals( myEvent.getDate() ) );
-               entityManager.getTransaction().commit();
-        entityManager.close();
-       }
-}
diff --git a/src/it/tutorials/envers/src/test/java/org/hibernate/tutorial/envers/Event.java b/src/it/tutorials/envers/src/test/java/org/hibernate/tutorial/envers/Event.java
deleted file mode 100644 (file)
index 64741a6..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors.  All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA  02110-1301  USA
- */
-package org.hibernate.tutorial.envers;
-
-import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import org.hibernate.annotations.GenericGenerator;
-import org.hibernate.envers.Audited;
-
-@Entity
-@Table( name = "EVENTS" )
-@Audited  // <--- this tell Envers to audit (track changes to) this entity
-public class Event {
-    private Long id;
-
-    private String title;
-    private Date date;
-
-       public Event() {
-               // this form used by Hibernate
-       }
-
-       public Event(String title, Date date) {
-               // for application use, to create new events
-               this.title = title;
-               this.date = date;
-       }
-
-       @Id
-       @GeneratedValue(generator="increment")
-       @GenericGenerator(name="increment", strategy = "increment")
-    public Long getId() {
-               return id;
-    }
-
-    private void setId(Long id) {
-               this.id = id;
-    }
-
-       @Temporal(TemporalType.TIMESTAMP)
-       @Column(name = "EVENT_DATE")
-    public Date getDate() {
-               return date;
-    }
-
-    public void setDate(Date date) {
-               this.date = date;
-    }
-
-    public String getTitle() {
-               return title;
-    }
-
-    public void setTitle(String title) {
-               this.title = title;
-    }
-
-       @Override
-       public int hashCode() {
-               int result = title.hashCode();
-               result = 31 * result + date.hashCode();
-               return result;
-       }
-}
\ No newline at end of file
diff --git a/src/it/tutorials/envers/src/test/resources/META-INF/persistence.xml b/src/it/tutorials/envers/src/test/resources/META-INF/persistence.xml
deleted file mode 100644 (file)
index fae7276..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<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="org.hibernate.tutorial.envers">
-        <description>
-            Persistence unit for the Envers tutorial of the Hibernate Getting Started Guide
-        </description>
-
-        <class>org.hibernate.tutorial.envers.Event</class>
-
-        <properties>
-            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
-            <property name="javax.persistence.jdbc.url" value="jdbc:h2:${project.build.directory}/db/test;MVCC=TRUE" />
-            <property name="javax.persistence.jdbc.user" value="sa" />
-            <property name="javax.persistence.jdbc.password" value="" />
-
-            <property name="hibernate.show_sql" value="true" />
-            <property name="hibernate.hbm2ddl.auto" value="create" />
-        </properties>
-
-    </persistence-unit>
-
-</persistence>
diff --git a/src/it/tutorials/osgi/managed-jpa/features.xml b/src/it/tutorials/osgi/managed-jpa/features.xml
deleted file mode 100755 (executable)
index 875daa5..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<features>
-       <feature name="hibernate-test">
-       
-           <feature>karaf-framework</feature>
-        
-        <!-- JTA -->
-        <config name="org.apache.aries.transaction">
-            aries.transaction.recoverable = true
-            aries.transaction.timeout = 600
-            aries.transaction.howl.logFileDir = /tmp/karaf/txlog
-            aries.transaction.howl.maxLogFiles = 2
-            aries.transaction.howl.maxBlocksPerFile = 512
-            aries.transaction.howl.bufferSizeKBytes = 4
-        </config>
-        <bundle dependency="true" start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
-        <bundle start-level="30">mvn:org.apache.aries.transaction/org.apache.aries.transaction.blueprint/1.0.0</bundle>
-        <bundle start-level="30">mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/1.0.1</bundle>
-        
-        <!-- JPA -->
-        <bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
-        <!-- No container currently supports JPA 2.1.  Clone and build Aries from the following fork (upgrades to
-             JPA 2.1).  Aries should be upgrading as soon as the spec is out.
-             https://github.com/brmeyer/aries/tree/jpa21 -->
-        <bundle start-level="30">mvn:org.apache.aries/org.apache.aries.util/1.1.1-SNAPSHOT</bundle>
-        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/1.0.1-SNAPSHOT</bundle>
-        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint.aries/1.0.2-SNAPSHOT</bundle>
-        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/1.0.1-SNAPSHOT</bundle>
-        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container.context/1.0.2-SNAPSHOT</bundle>
-        
-           <!-- JNDI -->
-        <bundle start-level="30">mvn:org.apache.aries/org.apache.aries.util/1.0.0</bundle>
-        <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.api/1.0.0</bundle>
-        <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.core/1.0.0</bundle>
-        <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.rmi/1.0.0</bundle>
-        <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.url/1.0.0</bundle>
-        <bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.legacy.support/1.0.0</bundle>
-        
-        <!-- Taken from Karaf-Tutorial -->
-        <bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
-               <bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
-               <bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
-               <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
-               <bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
-
-               <bundle>mvn:com.h2database/h2/1.3.170</bundle>
-               <bundle>blueprint:file:/[PATH]/datasource-h2.xml</bundle>
-
-               <!-- These do not natively support OSGi, so using 3rd party bundles. -->
-               <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
-               <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
-               
-               <!-- These do not natively support OSGi, so wrap with BND. -->
-               <bundle>wrap:mvn:org.jboss/jandex/1.1.0.Alpha1</bundle>
-               
-        <bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
-        <bundle>mvn:org.jboss.logging/jboss-logging/3.1.0.GA</bundle>
-               <bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
-               
-        <bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.3.Final</bundle>
-        
-        <bundle>mvn:org.hibernate/hibernate-core/4.3.0-SNAPSHOT</bundle>
-        <bundle>mvn:org.hibernate/hibernate-entitymanager/4.3.0-SNAPSHOT</bundle>
-        
-        <!-- TODO: It seems that the persistence unit bundle needs to be started
-        before hibernate-osgi.  When the BundleActivator is started,
-        the persistence unit is provided even though managed-jpa
-        hasn't completely started yet.  If that happens, you'll get an "illegal
-        bundle state" exception.  Is there a way for the activator to
-        watch for bundles with PUs before registering the persistence provider? -->
-        <bundle>mvn:org.hibernate.osgi/managed-jpa/1.0.0</bundle>
-        
-        <bundle>mvn:org.hibernate/hibernate-osgi/4.3.0-SNAPSHOT</bundle>
-       </feature>
-</features>
diff --git a/src/it/tutorials/osgi/managed-jpa/pom.xml b/src/it/tutorials/osgi/managed-jpa/pom.xml
deleted file mode 100644 (file)
index 8c9fa47..0000000
+++ /dev/null
@@ -1,90 +0,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>
-       <groupId>org.hibernate.osgi</groupId>
-       <artifactId>managed-jpa</artifactId>
-       <version>1.0.0</version>
-    <packaging>bundle</packaging>
-
-       <properties>
-               <h4mp.version>@project.version@</h4mp.version>
-       </properties>
-
-       <dependencies>
-               <dependency>
-                       <groupId>org.hibernate.javax.persistence</groupId>
-            <artifactId>hibernate-jpa-2.1-api</artifactId>
-            <version>1.0.0.Final</version>
-               </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <version>4.3.1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.enterprise</artifactId>
-            <version>4.2.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.karaf.shell</groupId>
-            <artifactId>org.apache.karaf.shell.console</artifactId>
-            <version>2.3.0</version>
-        </dependency>
-        <dependency>
-            <groupId>com.h2database</groupId>
-            <artifactId>h2</artifactId>
-            <version>1.4.187</version>
-        </dependency>
-       </dependencies>
-
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-                               <extensions>true</extensions>
-                               <configuration>
-                                       <instructions>
-                                               <Bundle-SymbolicName>org.hibernate.osgi.managed-jpa</Bundle-SymbolicName>
-                                               <Bundle-Name>managed-jpa</Bundle-Name>
-                                               <Bundle-Version>1.0.0</Bundle-Version>
-                                               <Export-Package>
-                                                   org.hibernate.osgitest,
-                                                       org.hibernate.osgitest.entity
-                                               </Export-Package>
-                                               <Import-Package>
-                                                   org.apache.felix.service.command,
-                            org.apache.felix.gogo.commands,
-                            org.apache.karaf.shell.console,
-                            org.apache.karaf.shell.commands,
-                            javax.persistence;version="[1.0.0,2.1.0]",
-                            <!-- Needed for proxying's Javassist enhancement during runtime -->
-                            org.hibernate.proxy,
-                            javassist.util.proxy,
-                            * 
-                                               </Import-Package>
-                                               <Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
-                                       </instructions>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>de.juplo</groupId>
-                               <artifactId>hibernate-maven-plugin</artifactId>
-                               <version>${h4mp.version}</version>
-                               <executions>
-                                       <execution>
-                                               <goals>
-                                                       <goal>create</goal>
-                                               </goals>
-                                       </execution>
-                               </executions>
-                               <configuration>
-                                       <url>jdbc:h2:mem:db_managed_jpa;MVCC=TRUE</url>
-                                       <format>true</format>
-                                       <execute>false</execute>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
-</project>
diff --git a/src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java b/src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java
deleted file mode 100644 (file)
index bdeaace..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import java.util.List;
-
-import org.hibernate.osgitest.entity.DataPoint;
-
-/**
- * @author Brett Meyer
- */
-public interface DataPointService {
-
-       public void add(DataPoint dp);
-
-       public List<DataPoint> getAll();
-
-       public void deleteAll();
-}
diff --git a/src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java b/src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java
deleted file mode 100644 (file)
index f324889..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.hibernate.osgitest.entity.DataPoint;
-
-/**
- * @author Brett Meyer
- */
-public class DataPointServiceImpl implements DataPointService {
-
-       private EntityManager entityManager;
-
-       public void add(DataPoint dp) {
-               entityManager.persist( dp );
-               entityManager.flush();
-       }
-
-       public List<DataPoint> getAll() {
-               return entityManager.createQuery( "select d from DataPoint d", DataPoint.class ).getResultList();
-       }
-
-       public void deleteAll() {
-               entityManager.createQuery( "delete from DataPoint" ).executeUpdate();
-               entityManager.flush();
-       }
-
-       public EntityManager getEntityManager() {
-               return entityManager;
-       }
-
-       public void setEntityManager(EntityManager entityManager) {
-               this.entityManager = entityManager;
-       }
-
-}
diff --git a/src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java b/src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java
deleted file mode 100644 (file)
index 9e9844c..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Argument;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.osgitest.DataPointService;
-import org.hibernate.osgitest.entity.DataPoint;
-
-@Command(scope = "dp", name = "add")
-public class AddCommand implements Action {
-    @Argument(index=0, name="Name", required=true, description="Name", multiValued=false)
-    String name;
-    
-    private DataPointService dpService;
-    
-    public void setDpService(DataPointService dpService) {
-        this.dpService = dpService;
-    }
-
-    public Object execute(CommandSession session) throws Exception {
-        DataPoint dp = new DataPoint();
-        dp.setName( name );
-        dpService.add( dp );
-        return null;
-    }
-
-}
diff --git a/src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java b/src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java
deleted file mode 100644 (file)
index d6c4ccf..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.osgitest.DataPointService;
-
-@Command(scope = "dp", name = "deleteAll")
-public class DeleteAllCommand implements Action {
-private DataPointService dpService;
-    
-    public void setDpService(DataPointService dpService) {
-        this.dpService = dpService;
-    }
-
-    public Object execute(CommandSession session) throws Exception {
-       dpService.deleteAll();
-        return null;
-    }
-
-}
diff --git a/src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java b/src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java
deleted file mode 100644 (file)
index ebdac60..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import java.util.List;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.osgitest.DataPointService;
-import org.hibernate.osgitest.entity.DataPoint;
-
-@Command(scope = "dp", name = "getAll")
-public class GetAllCommand implements Action {
-    private DataPointService dpService;
-    
-    public void setDpService(DataPointService dpService) {
-        this.dpService = dpService;
-    }
-
-    public Object execute(CommandSession session) throws Exception {
-        List<DataPoint> dps = dpService.getAll();
-        for (DataPoint dp : dps) {
-            System.out.println(dp.getId() + ", " + dp.getName());
-        }
-        return null;
-    }
-
-}
diff --git a/src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java b/src/it/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java
deleted file mode 100644 (file)
index 2a566d8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest.entity;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-/**
- * @author Brett Meyer
- */
-@Entity
-public class DataPoint {
-       @Id
-       @GeneratedValue
-       private long id;
-       
-       private String 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;
-       }
-}
diff --git a/src/it/tutorials/osgi/managed-jpa/src/main/resources/META-INF/persistence.xml b/src/it/tutorials/osgi/managed-jpa/src/main/resources/META-INF/persistence.xml
deleted file mode 100644 (file)
index 5db3a42..0000000
+++ /dev/null
@@ -1,15 +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"
-    version="1.0">
-    <persistence-unit name="managed-jpa" transaction-type="JTA">
-        <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/h2ds)</jta-data-source>
-        
-        <properties>
-            <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
-            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
-            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
-            <property name="hibernate.archive.autodetection" value="class"/>
-        </properties>
-    </persistence-unit>
-</persistence>
\ No newline at end of file
diff --git a/src/it/tutorials/osgi/managed-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/src/it/tutorials/osgi/managed-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644 (file)
index 529a4e1..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<blueprint  default-activation="eager" 
-            xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0"
-            xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0">
-
-  <!-- This gets the container-managed EntityManager and injects it into the DataPointServiceImpl bean. -->
-  <bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl"> 
-      <jpa:context unitname="managed-jpa" property="entityManager"/>
-      <tx:transaction method="*" value="Required"/>
-  </bean>
-  <service ref="dpService" interface="org.hibernate.osgitest.DataPointService" />
-  
-  <!-- This demonstrates how to register your custom implementations of Hibernate extension points, such as
-       Integrator and TypeContributor. -->
-  <!-- <bean id="integrator" class="your.package.IntegratorImpl"/>
-  <service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
-  <bean id="typeContributor" class="your.package.TypeContributorImpl"/>
-  <service ref="typeContributor" interface="org.hibernate.metamodel.spi.TypeContributor"/> -->
-  
-  <!-- This bundle makes use of Karaf commands to demonstrate core persistence operations.  Feel free to remove it. -->
-  <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
-        <command name="dp/add">
-            <action class="org.hibernate.osgitest.command.AddCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-        <command name="dp/getAll">
-            <action class="org.hibernate.osgitest.command.GetAllCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-        <command name="dp/deleteAll">
-            <action class="org.hibernate.osgitest.command.DeleteAllCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-    </command-bundle>
-</blueprint>
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/features.xml b/src/it/tutorials/osgi/unmanaged-jpa/features.xml
deleted file mode 100644 (file)
index 7c60a47..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<features>
-       <feature name="hibernate-test">
-       
-           <feature>karaf-framework</feature>
-           
-           <!-- JTA -->
-        <bundle start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
-        
-        <!-- JPA -->
-        <bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
-        
-        <!-- Taken from Karaf-Tutorial -->
-        <bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
-               <bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
-               <bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
-               <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
-               <bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
-
-               <bundle>mvn:com.h2database/h2/1.3.170</bundle>
-
-               <!-- These do not natively support OSGi, so using 3rd party bundles. -->
-               <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
-               <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
-               
-               <!-- These do not natively support OSGi, so wrap with BND. -->
-               <bundle>wrap:mvn:org.jboss/jandex/1.1.0.Alpha1</bundle>
-               
-        <bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
-        <bundle>mvn:org.jboss.logging/jboss-logging/3.1.0.GA</bundle>
-               <bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
-               
-        <bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.3.Final</bundle>
-        
-        <bundle>mvn:org.hibernate/hibernate-core/4.3.0-SNAPSHOT</bundle>
-        <bundle>mvn:org.hibernate/hibernate-entitymanager/4.3.0-SNAPSHOT</bundle>
-        <bundle>mvn:org.hibernate/hibernate-osgi/4.3.0-SNAPSHOT</bundle>
-        
-        <bundle>mvn:org.hibernate.osgi/unmanaged-jpa/1.0.0</bundle>
-       </feature>
-</features>
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/pom.xml b/src/it/tutorials/osgi/unmanaged-jpa/pom.xml
deleted file mode 100644 (file)
index c4c7cd0..0000000
+++ /dev/null
@@ -1,94 +0,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>
-       <groupId>org.hibernate.osgi</groupId>
-       <artifactId>unmanaged-jpa</artifactId>
-       <version>1.0.0</version>
-    <packaging>bundle</packaging>
-
-       <properties>
-               <h4mp.version>@project.version@</h4mp.version>
-       </properties>
-
-       <dependencies>
-               <dependency>
-            <groupId>org.hibernate.javax.persistence</groupId>
-            <artifactId>hibernate-jpa-2.1-api</artifactId>
-            <version>1.0.0.Final</version>
-        </dependency>
-               <dependency>
-                       <groupId>org.osgi</groupId>
-                       <artifactId>org.osgi.core</artifactId>
-                       <version>4.3.1</version>
-               </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.enterprise</artifactId>
-            <version>4.2.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.karaf.shell</groupId>
-            <artifactId>org.apache.karaf.shell.console</artifactId>
-            <version>2.3.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-entitymanager</artifactId>
-            <version>4.3.9.Final</version>
-        </dependency>
-               <dependency>
-                       <groupId>com.h2database</groupId>
-                       <artifactId>h2</artifactId>
-                       <version>1.4.187</version>
-               </dependency>
-        
-       </dependencies>
-
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-                               <extensions>true</extensions>
-                               <configuration>
-                                       <instructions>
-                                               <Bundle-SymbolicName>org.hibernate.osgi.unmanaged-jpa</Bundle-SymbolicName>
-                                               <Bundle-Name>unmanaged-jpa</Bundle-Name>
-                                               <Bundle-Version>1.0.0</Bundle-Version>
-                                               <Export-Package>
-                                                   org.hibernate.osgitest,
-                                                       org.hibernate.osgitest.entity
-                                               </Export-Package>
-                                               <Import-Package>
-                                                   org.apache.felix.service.command,
-                            org.apache.felix.gogo.commands,
-                            org.apache.karaf.shell.console,
-                            org.apache.karaf.shell.commands,
-                            org.h2,
-                            javax.persistence;version="[1.0.0,2.1.0]",
-                            <!-- Needed for proxying's Javassist enhancement during runtime -->
-                            org.hibernate.proxy,
-                            javassist.util.proxy,
-                            * 
-                                               </Import-Package>
-                                       </instructions>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>de.juplo</groupId>
-                               <artifactId>hibernate-maven-plugin</artifactId>
-                               <version>${h4mp.version}</version>
-                               <configuration>
-                                       <format>true</format>
-                               </configuration>
-                               <executions>
-                                       <execution>
-                                               <goals>
-                                                       <goal>create</goal>
-                                               </goals>
-                                       </execution>
-                               </executions>
-                       </plugin>
-               </plugins>
-       </build>
-</project>
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java b/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointService.java
deleted file mode 100644 (file)
index de8c960..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import java.util.List;
-
-import org.hibernate.osgitest.entity.DataPoint;
-
-/**
- * @author Brett Meyer
- */
-public interface DataPointService {
-
-       public void add(DataPoint dp);
-
-       public void update(DataPoint dp);
-
-       public DataPoint get(long id);
-
-       public List<DataPoint> getAll();
-
-       public void deleteAll();
-}
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java b/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java
deleted file mode 100644 (file)
index dba3609..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.hibernate.osgitest.entity.DataPoint;
-
-/**
- * @author Brett Meyer
- */
-public class DataPointServiceImpl implements DataPointService {
-       
-       private HibernateUtil hibernateUtil = new HibernateUtil();
-
-       public void add(DataPoint dp) {
-               EntityManager em = hibernateUtil.getEntityManager();
-               em.getTransaction().begin();
-               em.persist( dp );
-               em.getTransaction().commit();
-               em.close();
-       }
-
-       public void update(DataPoint dp) {
-               EntityManager em = hibernateUtil.getEntityManager();
-               em.getTransaction().begin();
-               em.merge( dp );
-               em.getTransaction().commit();
-               em.close();
-       }
-
-       public DataPoint get(long id) {
-               EntityManager em = hibernateUtil.getEntityManager();
-               em.getTransaction().begin();
-               DataPoint dp = (DataPoint) em.createQuery( "from DataPoint dp where dp.id=" + id ).getSingleResult();
-               em.getTransaction().commit();
-               em.close();
-               return dp;
-       }
-
-       public List<DataPoint> getAll() {
-               EntityManager em = hibernateUtil.getEntityManager();
-               em.getTransaction().begin();
-               List list = em.createQuery( "from DataPoint" ).getResultList();
-               em.getTransaction().commit();
-               em.close();
-               return list;
-       }
-
-       public void deleteAll() {
-               EntityManager em = hibernateUtil.getEntityManager();
-               em.getTransaction().begin();
-               em.createQuery( "delete from DataPoint" ).executeUpdate();
-               em.getTransaction().commit();
-               em.close();
-       }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/HibernateUtil.java b/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/HibernateUtil.java
deleted file mode 100644 (file)
index 0927f15..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.spi.PersistenceProvider;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-
-/**
- * @author Brett Meyer
- */
-
-public class HibernateUtil {
-
-       private EntityManagerFactory emf;
-
-       public EntityManager getEntityManager() {
-               return getEntityManagerFactory().createEntityManager();
-       }
-
-       private EntityManagerFactory getEntityManagerFactory() {
-               if ( emf == null ) {
-                       Bundle thisBundle = FrameworkUtil.getBundle( HibernateUtil.class );
-                       // Could get this by wiring up OsgiTestBundleActivator as well.
-                       BundleContext context = thisBundle.getBundleContext();
-
-                       ServiceReference serviceReference = context.getServiceReference( PersistenceProvider.class.getName() );
-                       PersistenceProvider persistenceProvider = (PersistenceProvider) context.getService( serviceReference );
-
-                       emf = persistenceProvider.createEntityManagerFactory( "unmanaged-jpa", null );
-               }
-               return emf;
-       }
-}
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestIntegrator.java b/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestIntegrator.java
deleted file mode 100644 (file)
index 8ba8f6a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import org.hibernate.cfg.Configuration;
-import org.hibernate.engine.spi.SessionFactoryImplementor;
-import org.hibernate.integrator.spi.Integrator;
-import org.hibernate.metamodel.source.MetadataImplementor;
-import org.hibernate.service.spi.SessionFactoryServiceRegistry;
-
-
-/**
- * @author Brett Meyer
- */
-public class TestIntegrator implements Integrator {
-
-       public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
-               System.out.println("Integrator#integrate");
-       }
-
-       public void integrate(MetadataImplementor metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
-               System.out.println("Integrator#integrate");
-       }
-
-       public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
-               System.out.println("Integrator#disintegrate");
-       }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java b/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java
deleted file mode 100644 (file)
index f7ad26f..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import java.util.Collections;
-
-import org.hibernate.boot.registry.selector.StrategyRegistration;
-import org.hibernate.boot.registry.selector.StrategyRegistrationProvider;
-
-/**
- * @author Brett Meyer
- */
-public class TestStrategyRegistrationProvider implements StrategyRegistrationProvider {
-
-       public Iterable<StrategyRegistration> getStrategyRegistrations() {
-               System.out.println("StrategyRegistrationProvider#getStrategyRegistrations");
-               return Collections.EMPTY_LIST;
-       }
-}
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestTypeContributor.java b/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/TestTypeContributor.java
deleted file mode 100644 (file)
index cc6494c..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import org.hibernate.metamodel.spi.TypeContributions;
-import org.hibernate.metamodel.spi.TypeContributor;
-import org.hibernate.service.ServiceRegistry;
-
-
-/**
- * @author Brett Meyer
- */
-public class TestTypeContributor implements TypeContributor {
-
-       public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
-               System.out.println("TypeContributor#contribute");
-       }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java b/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/AddCommand.java
deleted file mode 100644 (file)
index c1b906c..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Argument;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.osgitest.DataPointService;
-import org.hibernate.osgitest.entity.DataPoint;
-
-@Command(scope = "dp", name = "addJPA")
-public class AddCommand implements Action {
-    @Argument(index=0, name="Name", required=true, description="Name", multiValued=false)
-    String name;
-    
-    private DataPointService dpService;
-    
-    public void setDpService(DataPointService dpService) {
-        this.dpService = dpService;
-    }
-
-    public Object execute(CommandSession session) throws Exception {
-        DataPoint dp = new DataPoint();
-        dp.setName( name );
-        dpService.add( dp );
-        return null;
-    }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java b/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java
deleted file mode 100644 (file)
index 0d404ae..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.osgitest.DataPointService;
-
-@Command(scope = "dp", name = "deleteAllJPA")
-public class DeleteAllCommand implements Action {
-private DataPointService dpService;
-    
-    public void setDpService(DataPointService dpService) {
-        this.dpService = dpService;
-    }
-
-    public Object execute(CommandSession session) throws Exception {
-       dpService.deleteAll();
-        return null;
-    }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java b/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java
deleted file mode 100644 (file)
index 6873e46..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import java.util.List;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.osgitest.DataPointService;
-import org.hibernate.osgitest.entity.DataPoint;
-
-@Command(scope = "dp", name = "getAllJPA")
-public class GetAllCommand implements Action {
-    private DataPointService dpService;
-    
-    public void setDpService(DataPointService dpService) {
-        this.dpService = dpService;
-    }
-
-    public Object execute(CommandSession session) throws Exception {
-        List<DataPoint> dps = dpService.getAll();
-        for (DataPoint dp : dps) {
-            System.out.println(dp.getId() + ", " + dp.getName());
-        }
-        return null;
-    }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java b/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java
deleted file mode 100644 (file)
index 5de8983..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Argument;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.osgitest.DataPointService;
-import org.hibernate.osgitest.entity.DataPoint;
-
-@Command(scope = "dp", name = "updateJPA")
-public class UpdateCommand implements Action {
-    @Argument(index=0, name="Id", required=true, description="Id", multiValued=false)
-    String id;
-    
-    @Argument(index=1, name="Name", required=true, description="Name", multiValued=false)
-    String name;
-    
-    private DataPointService dpService;
-    
-    public void setDpService(DataPointService dpService) {
-        this.dpService = dpService;
-    }
-
-    public Object execute(CommandSession session) throws Exception {
-        DataPoint dp = dpService.get( Long.valueOf( id ) );
-        dp.setName( name );
-        dpService.update( dp );
-        return null;
-    }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java b/src/it/tutorials/osgi/unmanaged-jpa/src/main/java/org/hibernate/osgitest/entity/DataPoint.java
deleted file mode 100644 (file)
index 2a566d8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest.entity;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-/**
- * @author Brett Meyer
- */
-@Entity
-public class DataPoint {
-       @Id
-       @GeneratedValue
-       private long id;
-       
-       private String 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;
-       }
-}
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/resources/META-INF/persistence.xml b/src/it/tutorials/osgi/unmanaged-jpa/src/main/resources/META-INF/persistence.xml
deleted file mode 100644 (file)
index 0483f5c..0000000
+++ /dev/null
@@ -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"
-    version="1.0">
-    <persistence-unit name="unmanaged-jpa">
-        <class>org.hibernate.osgitest.entity.DataPoint</class>
-        <exclude-unlisted-classes>true</exclude-unlisted-classes>
-        
-        <properties>
-            <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
-            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
-            <property name="hibernate.connection.url" value="jdbc:h2:mem:db_unmanaged_jpa;DB_CLOSE_DELAY=-1;MVCC=TRUE"/>
-            <property name="hibernate.connection.username" value="sa"/>
-            <property name="hibernate.connection.password" value=""/>
-            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
-        </properties>
-    </persistence-unit>
-</persistence>
diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/src/it/tutorials/osgi/unmanaged-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644 (file)
index 2dedb95..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<blueprint  default-activation="eager" 
-            xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
-  <bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl"/>
-  <service ref="dpService" interface="org.hibernate.osgitest.DataPointService" />
-  
-  <!-- This demonstrates how to register your custom implementations of Hibernate extension points. -->
-            
-  <bean id="integrator" class="org.hibernate.osgitest.TestIntegrator"/>
-  <service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
-
-  <bean id="strategyRegistrationProvider" class="org.hibernate.osgitest.TestStrategyRegistrationProvider"/>
-  <service ref="strategyRegistrationProvider" interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
-            
-  <bean id="typeContributor" class="org.hibernate.osgitest.TestTypeContributor"/>
-  <service ref="typeContributor" interface="org.hibernate.metamodel.spi.TypeContributor"/>
-  
-  <!-- This bundle makes use of Karaf commands to demonstrate core persistence operations.  Feel free to remove it. -->
-  <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
-        <command name="dp:add">
-            <action class="org.hibernate.osgitest.command.AddCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-        <command name="dp:update">
-            <action class="org.hibernate.osgitest.command.UpdateCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-        <command name="dp:getAll">
-            <action class="org.hibernate.osgitest.command.GetAllCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-        <command name="dp:deleteAll">
-            <action class="org.hibernate.osgitest.command.DeleteAllCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-    </command-bundle>
-</blueprint>
diff --git a/src/it/tutorials/osgi/unmanaged-native/features.xml b/src/it/tutorials/osgi/unmanaged-native/features.xml
deleted file mode 100644 (file)
index b2e0816..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<features>
-       <feature name="hibernate-test">
-       
-           <feature>karaf-framework</feature>
-           
-           <!-- JTA -->
-        <bundle start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
-        
-        <!-- JPA -->
-        <bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
-        
-        <!-- Taken from Karaf-Tutorial -->
-        <bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
-               <bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
-               <bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
-               <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
-               <bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
-
-               <bundle>mvn:com.h2database/h2/1.3.170</bundle>
-
-               <!-- These do not natively support OSGi, so using 3rd party bundles. -->
-               <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
-               <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
-               
-               <!-- These do not natively support OSGi, so wrap with BND. -->
-               <bundle>wrap:mvn:org.jboss/jandex/1.1.0.Alpha1</bundle>
-               <!-- Optional.  Needed to test C3P0 connection pools. -->
-               <!-- <bundle>wrap:mvn:c3p0/c3p0/0.9.1</bundle> -->
-               <!-- Optional.  Needed to test Proxool connection pools. -->
-               <!-- <bundle>wrap:mvn:proxool/proxool/0.8.3</bundle> -->
-               <!-- Optional.  Needed to test ehcache 2lc. -->
-               <!-- <bundle>wrap:mvn:net.sf.ehcache/ehcache-core/2.4.3</bundle> -->
-               
-        <bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
-        <bundle>mvn:org.jboss.logging/jboss-logging/3.1.0.GA</bundle>
-               <bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
-               
-        <bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.3.Final</bundle>
-        
-        <!-- JACC is optional. -->
-        <!--<bundle>mvn:javax.servlet/javax.servlet-api/3.0.1</bundle>
-        <bundle>mvn:org.jboss.spec.javax.security.jacc/jboss-jacc-api_1.4_spec/1.0.2.Final</bundle>-->
-        
-        <!-- hibernate-validator is optional. -->
-        <!--<bundle>wrap:mvn:javax.validation/validation-api/1.0.0.GA</bundle>
-        <bundle>mvn:org.hibernate/hibernate-validator/4.2.0.Final</bundle>-->
-        
-               <!-- Optional.  Needed to test infinispan 2lc. -->
-               <!-- IMPORTANT: Infinispan requires the JRE sun.misc package.  You
-               MUST enable this in your OSGi container.  For Karaf, add
-               "org.osgi.framework.system.packages.extra=sun.misc" to etc/config.properties -->
-               <!-- <bundle>wrap:mvn:org.jboss.marshalling/jboss-marshalling/1.3.17.GA</bundle>
-               <bundle>wrap:mvn:org.jboss.marshalling/jboss-marshalling-river/1.3.17.GA</bundle>
-               <bundle>wrap:mvn:org.jboss/staxmapper/1.1.0.Final</bundle>
-               <bundle>mvn:org.jgroups/jgroups/3.2.8.Final</bundle>
-               <bundle>mvn:org.infinispan/infinispan-core/5.2.0.Beta3</bundle> -->
-
-        <bundle>mvn:org.hibernate/hibernate-core/4.3.0-SNAPSHOT</bundle>
-        <!-- TODO: Shouldn't need this, but hibernate-osgi's activator is a catch-all for SF and EMF. -->
-        <bundle>mvn:org.hibernate/hibernate-entitymanager/4.3.0-SNAPSHOT</bundle>
-        <bundle>mvn:org.hibernate/hibernate-envers/4.3.0-SNAPSHOT</bundle>
-        <!-- <bundle>mvn:org.hibernate/hibernate-c3p0/4.3.0-SNAPSHOT</bundle> -->
-        <!-- <bundle>mvn:org.hibernate/hibernate-proxool/4.3.0-SNAPSHOT</bundle> -->
-        <!-- <bundle>mvn:org.hibernate/hibernate-ehcache/4.3.0-SNAPSHOT</bundle> -->
-        <!-- <bundle>mvn:org.hibernate/hibernate-infinispan/4.3.0-SNAPSHOT</bundle> -->
-        <bundle>mvn:org.hibernate/hibernate-osgi/4.3.0-SNAPSHOT</bundle>
-        
-        <bundle>mvn:org.hibernate.osgi/unmanaged-native/1.0.0</bundle>
-       </feature>
-</features>
diff --git a/src/it/tutorials/osgi/unmanaged-native/pom.xml b/src/it/tutorials/osgi/unmanaged-native/pom.xml
deleted file mode 100644 (file)
index f91f11a..0000000
+++ /dev/null
@@ -1,102 +0,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>
-       <groupId>org.hibernate.osgi</groupId>
-       <artifactId>unmanaged-native</artifactId>
-       <version>1.0.0</version>
-    <packaging>bundle</packaging>
-
-       <properties>
-               <h4mp.version>@project.version@</h4mp.version>
-       </properties>
-
-       <dependencies>
-               <dependency>
-            <groupId>org.hibernate.javax.persistence</groupId>
-            <artifactId>hibernate-jpa-2.1-api</artifactId>
-            <version>1.0.0.Final</version>
-        </dependency>
-               <dependency>
-                       <groupId>org.osgi</groupId>
-                       <artifactId>org.osgi.core</artifactId>
-                       <version>4.3.1</version>
-               </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.enterprise</artifactId>
-            <version>4.2.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.karaf.shell</groupId>
-            <artifactId>org.apache.karaf.shell.console</artifactId>
-            <version>2.3.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-core</artifactId>
-            <version>4.3.9.Final</version>
-        </dependency>
-        <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-envers</artifactId>
-            <version>4.3.9.Final</version>
-        </dependency>
-               <dependency>
-                       <groupId>com.h2database</groupId>
-                       <artifactId>h2</artifactId>
-                       <version>1.4.187</version>
-               </dependency>
-        
-       </dependencies>
-
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-                               <extensions>true</extensions>
-                               <configuration>
-                                       <instructions>
-                                               <Bundle-SymbolicName>org.hibernate.osgi.unmanaged-native</Bundle-SymbolicName>
-                                               <Bundle-Name>unmanaged-native</Bundle-Name>
-                                               <Bundle-Version>1.0.0</Bundle-Version>
-                                               <Export-Package>
-                                                   org.hibernate.osgitest,
-                                                       org.hibernate.osgitest.entity
-                                               </Export-Package>
-                                               <Import-Package>
-                                                   org.apache.felix.service.command,
-                            org.apache.felix.gogo.commands,
-                            org.apache.karaf.shell.console,
-                            org.apache.karaf.shell.commands,
-                            org.h2,
-                            org.hibernate,
-                            org.hibernate.cfg,
-                            org.hibernate.service,
-                            javax.persistence;version="[1.0.0,2.1.0]",
-                            <!-- Needed for proxying's Javassist enhancement during runtime -->
-                            org.hibernate.proxy,
-                            javassist.util.proxy,
-                            * 
-                                               </Import-Package>
-                                       </instructions>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>de.juplo</groupId>
-                               <artifactId>hibernate-maven-plugin</artifactId>
-                               <version>${h4mp.version}</version>
-                               <configuration>
-                                       <format>true</format>
-                               </configuration>
-                               <executions>
-                                       <execution>
-                                               <goals>
-                                                       <goal>create</goal>
-                                               </goals>
-                                       </execution>
-                               </executions>
-                       </plugin>
-               </plugins>
-       </build>
-</project>
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointService.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointService.java
deleted file mode 100644 (file)
index 12fb79a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import java.util.List;
-import java.util.Map;
-
-import org.hibernate.envers.DefaultRevisionEntity;
-import org.hibernate.osgitest.entity.DataPoint;
-
-/**
- * @author Brett Meyer
- */
-public interface DataPointService {
-
-       public void add(DataPoint dp);
-
-       public void update(DataPoint dp);
-
-       public DataPoint get(long id);
-
-       public DataPoint load(long id);
-
-       public List<DataPoint> getAll();
-
-       public Map<Number, DefaultRevisionEntity> getRevisions(long id);
-
-       public void deleteAll();
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java
deleted file mode 100644 (file)
index 721b740..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-
-import org.hibernate.Hibernate;
-import org.hibernate.Session;
-import org.hibernate.criterion.Restrictions;
-import org.hibernate.envers.AuditReader;
-import org.hibernate.envers.AuditReaderFactory;
-import org.hibernate.envers.DefaultRevisionEntity;
-import org.hibernate.osgitest.entity.DataPoint;
-
-/**
- * @author Brett Meyer
- */
-public class DataPointServiceImpl implements DataPointService {
-       
-       private HibernateUtil hibernateUtil = new HibernateUtil();
-
-       public void add(DataPoint dp) {
-               Session s = hibernateUtil.getSession();
-               s.getTransaction().begin();
-               s.persist( dp );
-               s.getTransaction().commit();
-               s.close();
-       }
-
-       public void update(DataPoint dp) {
-               Session s = hibernateUtil.getSession();
-               s.getTransaction().begin();
-               s.update( dp );
-               s.getTransaction().commit();
-               s.close();
-       }
-
-       public DataPoint get(long id) {
-               Session s = hibernateUtil.getSession();
-               s.getTransaction().begin();
-               DataPoint dp = (DataPoint) s.createCriteria( DataPoint.class ).add(
-                               Restrictions.eq( "id", id ) ).uniqueResult();
-               s.getTransaction().commit();
-               s.close();
-               return dp;
-       }
-
-       // Test lazy loading (mainly to make sure the proxy classes work in OSGi)
-       public DataPoint load(long id) {
-               Session s = hibernateUtil.getSession();
-               s.getTransaction().begin();
-               DataPoint dp = (DataPoint) s.load( DataPoint.class, new Long(id) );
-               // initialize
-               dp.getName();
-               s.getTransaction().commit();
-               s.close();
-               return dp;
-       }
-
-       public List<DataPoint> getAll() {
-               Session s = hibernateUtil.getSession();
-               s.getTransaction().begin();
-               List list = s.createQuery( "from DataPoint" ).list();
-               s.getTransaction().commit();
-               s.close();
-               return list;
-       }
-       
-       public Map<Number, DefaultRevisionEntity> getRevisions(long id) {
-               Session s = hibernateUtil.getSession();
-               AuditReader reader = AuditReaderFactory.get(s);
-               List<Number> revisionNums = reader.getRevisions( DataPoint.class, id );
-               return reader.findRevisions( DefaultRevisionEntity.class, new HashSet<Number>(revisionNums) );
-       }
-
-       public void deleteAll() {
-               Session s = hibernateUtil.getSession();
-               s.getTransaction().begin();
-               s.createQuery( "delete from DataPoint" ).executeUpdate();
-               s.getTransaction().commit();
-               s.close();
-       }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/HibernateUtil.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/HibernateUtil.java
deleted file mode 100644 (file)
index 15fb4c7..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-
-/**
- * @author Brett Meyer
- */
-
-public class HibernateUtil {
-
-       private SessionFactory sf;
-
-       public Session getSession() {
-               return getSessionFactory().openSession();
-       }
-
-       private SessionFactory getSessionFactory() {
-               if ( sf == null ) {
-                       Bundle thisBundle = FrameworkUtil.getBundle( HibernateUtil.class );
-                       // Could get this by wiring up OsgiTestBundleActivator as well.
-                       BundleContext context = thisBundle.getBundleContext();
-
-                       ServiceReference sr = context.getServiceReference( SessionFactory.class.getName() );
-                       sf = (SessionFactory) context.getService( sr );
-               }
-               return sf;
-       }
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestIntegrator.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestIntegrator.java
deleted file mode 100644 (file)
index 8ba8f6a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import org.hibernate.cfg.Configuration;
-import org.hibernate.engine.spi.SessionFactoryImplementor;
-import org.hibernate.integrator.spi.Integrator;
-import org.hibernate.metamodel.source.MetadataImplementor;
-import org.hibernate.service.spi.SessionFactoryServiceRegistry;
-
-
-/**
- * @author Brett Meyer
- */
-public class TestIntegrator implements Integrator {
-
-       public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
-               System.out.println("Integrator#integrate");
-       }
-
-       public void integrate(MetadataImplementor metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
-               System.out.println("Integrator#integrate");
-       }
-
-       public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
-               System.out.println("Integrator#disintegrate");
-       }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestStrategyRegistrationProvider.java
deleted file mode 100644 (file)
index f7ad26f..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import java.util.Collections;
-
-import org.hibernate.boot.registry.selector.StrategyRegistration;
-import org.hibernate.boot.registry.selector.StrategyRegistrationProvider;
-
-/**
- * @author Brett Meyer
- */
-public class TestStrategyRegistrationProvider implements StrategyRegistrationProvider {
-
-       public Iterable<StrategyRegistration> getStrategyRegistrations() {
-               System.out.println("StrategyRegistrationProvider#getStrategyRegistrations");
-               return Collections.EMPTY_LIST;
-       }
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestTypeContributor.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/TestTypeContributor.java
deleted file mode 100644 (file)
index cc6494c..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest;
-
-import org.hibernate.metamodel.spi.TypeContributions;
-import org.hibernate.metamodel.spi.TypeContributor;
-import org.hibernate.service.ServiceRegistry;
-
-
-/**
- * @author Brett Meyer
- */
-public class TestTypeContributor implements TypeContributor {
-
-       public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
-               System.out.println("TypeContributor#contribute");
-       }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/AddCommand.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/AddCommand.java
deleted file mode 100644 (file)
index 9e9844c..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Argument;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.osgitest.DataPointService;
-import org.hibernate.osgitest.entity.DataPoint;
-
-@Command(scope = "dp", name = "add")
-public class AddCommand implements Action {
-    @Argument(index=0, name="Name", required=true, description="Name", multiValued=false)
-    String name;
-    
-    private DataPointService dpService;
-    
-    public void setDpService(DataPointService dpService) {
-        this.dpService = dpService;
-    }
-
-    public Object execute(CommandSession session) throws Exception {
-        DataPoint dp = new DataPoint();
-        dp.setName( name );
-        dpService.add( dp );
-        return null;
-    }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/DeleteAllCommand.java
deleted file mode 100644 (file)
index d6c4ccf..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.osgitest.DataPointService;
-
-@Command(scope = "dp", name = "deleteAll")
-public class DeleteAllCommand implements Action {
-private DataPointService dpService;
-    
-    public void setDpService(DataPointService dpService) {
-        this.dpService = dpService;
-    }
-
-    public Object execute(CommandSession session) throws Exception {
-       dpService.deleteAll();
-        return null;
-    }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetAllCommand.java
deleted file mode 100644 (file)
index ebdac60..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import java.util.List;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.osgitest.DataPointService;
-import org.hibernate.osgitest.entity.DataPoint;
-
-@Command(scope = "dp", name = "getAll")
-public class GetAllCommand implements Action {
-    private DataPointService dpService;
-    
-    public void setDpService(DataPointService dpService) {
-        this.dpService = dpService;
-    }
-
-    public Object execute(CommandSession session) throws Exception {
-        List<DataPoint> dps = dpService.getAll();
-        for (DataPoint dp : dps) {
-            System.out.println(dp.getId() + ", " + dp.getName());
-        }
-        return null;
-    }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetCommand.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetCommand.java
deleted file mode 100644 (file)
index 0597d70..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Argument;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.osgitest.DataPointService;
-import org.hibernate.osgitest.entity.DataPoint;
-
-@Command(scope = "dp", name = "get")
-public class GetCommand implements Action {
-       @Argument(index = 0, name = "Id", required = true, description = "Id", multiValued = false)
-       String id;
-
-       private DataPointService dpService;
-
-       public void setDpService(DataPointService dpService) {
-               this.dpService = dpService;
-       }
-
-       public Object execute(CommandSession session) throws Exception {
-               DataPoint dp = dpService.get( Long.valueOf( id ) );
-               System.out.println( dp.getId() + ", " + dp.getName() );
-               return null;
-       }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetRevisionsCommand.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/GetRevisionsCommand.java
deleted file mode 100644 (file)
index b4573f6..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import java.util.Map;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Argument;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.envers.DefaultRevisionEntity;
-import org.hibernate.osgitest.DataPointService;
-
-@Command(scope = "dp", name = "getRevisions")
-public class GetRevisionsCommand implements Action {
-       @Argument(index=0, name="Id", required=true, description="Id", multiValued=false)
-    String id;
-       
-    private DataPointService dpService;
-    
-    public void setDpService(DataPointService dpService) {
-        this.dpService = dpService;
-    }
-
-    public Object execute(CommandSession session) throws Exception {
-       Map<Number, DefaultRevisionEntity> revisions = dpService.getRevisions(Long.valueOf( id ));
-        for (Number revisionNum : revisions.keySet()) {
-               DefaultRevisionEntity dre = revisions.get( revisionNum );
-            System.out.println(revisionNum + ": " + dre.getId() + ", " + dre.getTimestamp());
-        }
-        return null;
-    }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/LoadCommand.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/LoadCommand.java
deleted file mode 100644 (file)
index 3451a98..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Argument;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.osgitest.DataPointService;
-import org.hibernate.osgitest.entity.DataPoint;
-
-@Command(scope = "dp", name = "load")
-public class LoadCommand implements Action {
-       @Argument(index = 0, name = "Id", required = true, description = "Id", multiValued = false)
-       String id;
-
-       private DataPointService dpService;
-
-       public void setDpService(DataPointService dpService) {
-               this.dpService = dpService;
-       }
-
-       public Object execute(CommandSession session) throws Exception {
-               DataPoint dp = dpService.load( Long.valueOf( id ) );
-               System.out.println( dp.getId() + ", " + dp.getName() );
-               return null;
-       }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/command/UpdateCommand.java
deleted file mode 100644 (file)
index f694967..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.hibernate.osgitest.command;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Argument;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.service.command.CommandSession;
-import org.hibernate.osgitest.DataPointService;
-import org.hibernate.osgitest.entity.DataPoint;
-
-@Command(scope = "dp", name = "update")
-public class UpdateCommand implements Action {
-    @Argument(index=0, name="Id", required=true, description="Id", multiValued=false)
-    String id;
-    
-    @Argument(index=1, name="Name", required=true, description="Name", multiValued=false)
-    String name;
-    
-    private DataPointService dpService;
-    
-    public void setDpService(DataPointService dpService) {
-        this.dpService = dpService;
-    }
-
-    public Object execute(CommandSession session) throws Exception {
-        DataPoint dp = dpService.get( Long.valueOf( id ) );
-        dp.setName( name );
-        dpService.update( dp );
-        return null;
-    }
-
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/entity/DataPoint.java b/src/it/tutorials/osgi/unmanaged-native/src/main/java/org/hibernate/osgitest/entity/DataPoint.java
deleted file mode 100644 (file)
index 2e5ef72..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* 
- * Hibernate, Relational Persistence for Idiomatic Java
- * 
- * JBoss, Home of Professional Open Source
- * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.hibernate.osgitest.entity;
-
-import java.io.Serializable;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-import org.hibernate.envers.Audited;
-
-/**
- * @author Brett Meyer
- */
-@Entity
-@Audited
-public class DataPoint implements Serializable {
-       @Id
-       @GeneratedValue
-       private long id;
-       
-       private String 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;
-       }
-}
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/src/it/tutorials/osgi/unmanaged-native/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644 (file)
index 3f4b2b4..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<blueprint  default-activation="eager" 
-            xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
-  <bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl"/>
-  <service ref="dpService" interface="org.hibernate.osgitest.DataPointService" />
-  
-  <!-- This demonstrates how to register your custom implementations of Hibernate extension points. -->
-            
-  <bean id="integrator" class="org.hibernate.osgitest.TestIntegrator"/>
-  <service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
-
-  <bean id="strategyRegistrationProvider" class="org.hibernate.osgitest.TestStrategyRegistrationProvider"/>
-  <service ref="strategyRegistrationProvider" interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
-            
-  <bean id="typeContributor" class="org.hibernate.osgitest.TestTypeContributor"/>
-  <service ref="typeContributor" interface="org.hibernate.metamodel.spi.TypeContributor"/>
-  
-  <!-- This bundle makes use of Karaf commands to demonstrate core persistence operations.  Feel free to remove it. -->
-  <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
-        <command name="dp:add">
-            <action class="org.hibernate.osgitest.command.AddCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-        <command name="dp:update">
-            <action class="org.hibernate.osgitest.command.UpdateCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-        <command name="dp:get">
-            <action class="org.hibernate.osgitest.command.GetCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-        <command name="dp:load">
-            <action class="org.hibernate.osgitest.command.LoadCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-        <command name="dp:getAll">
-            <action class="org.hibernate.osgitest.command.GetAllCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-        <command name="dp:getRevisions">
-            <action class="org.hibernate.osgitest.command.GetRevisionsCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-        <command name="dp:deleteAll">
-            <action class="org.hibernate.osgitest.command.DeleteAllCommand">
-                <property name="dpService" ref="dpService"/>
-            </action>
-        </command>
-    </command-bundle>
-</blueprint>
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/resources/ehcache.xml b/src/it/tutorials/osgi/unmanaged-native/src/main/resources/ehcache.xml
deleted file mode 100644 (file)
index 11fddc7..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-<!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors. All third-party contributions are
-  ~ distributed under license by Red Hat Middleware LLC.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<ehcache>
-
-    <!-- Sets the path to the directory where cache .data files are created.
-
-         If the path is a Java System Property it is replaced by
-         its value in the running VM.
-
-         The following properties are translated:
-         user.home - User's home directory
-         user.dir - User's current working directory
-         java.io.tmpdir - Default temp file path -->
-    <diskStore path="./target/tmp"/>
-
-
-    <!--Default Cache configuration. These will applied to caches programmatically created through
-        the CacheManager.
-
-        The following attributes are required for defaultCache:
-
-        maxInMemory       - Sets the maximum number of objects that will be created in memory
-        eternal           - Sets whether elements are eternal. If eternal,  timeouts are ignored and the element
-                            is never expired.
-        timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
-                            if the element is not eternal. Idle time is now - last accessed time
-        timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
-                            if the element is not eternal. TTL is now - creation time
-        overflowToDisk    - Sets whether elements can overflow to disk when the in-memory cache
-                            has reached the maxInMemory limit.
-
-        -->
-    <defaultCache
-        maxElementsInMemory="10000"
-        eternal="false"
-        timeToIdleSeconds="120"
-        timeToLiveSeconds="120"
-        overflowToDisk="true"
-        />
-
-    <!--Predefined caches.  Add your cache configuration settings here.
-        If you do not have a configuration for your cache a WARNING will be issued when the
-        CacheManager starts
-
-        The following attributes are required for defaultCache:
-
-        name              - Sets the name of the cache. This is used to identify the cache. It must be unique.
-        maxInMemory       - Sets the maximum number of objects that will be created in memory
-        eternal           - Sets whether elements are eternal. If eternal,  timeouts are ignored and the element
-                            is never expired.
-        timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
-                            if the element is not eternal. Idle time is now - last accessed time
-        timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
-                            if the element is not eternal. TTL is now - creation time
-        overflowToDisk    - Sets whether elements can overflow to disk when the in-memory cache
-                            has reached the maxInMemory limit.
-
-        -->
-
-    <!-- Sample cache named sampleCache1
-        This cache contains a maximum in memory of 10000 elements, and will expire
-        an element if it is idle for more than 5 minutes and lives for more than
-        10 minutes.
-
-        If there are more than 10000 elements it will overflow to the
-        disk cache, which in this configuration will go to wherever java.io.tmp is
-        defined on your system. On a standard Linux system this will be /tmp"
-        -->
-    <cache name="sampleCache1"
-        maxElementsInMemory="10000"
-        eternal="false"
-        timeToIdleSeconds="300"
-        timeToLiveSeconds="600"
-        overflowToDisk="true"
-        />
-
-    <!-- Sample cache named sampleCache2
-        This cache contains 1000 elements. Elements will always be held in memory.
-        They are not expired. -->
-    <cache name="sampleCache2"
-        maxElementsInMemory="1000"
-        eternal="true"
-        timeToIdleSeconds="0"
-        timeToLiveSeconds="0"
-        overflowToDisk="false"
-        /> -->
-
-    <!-- Place configuration for your caches following -->
-
-</ehcache>
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/resources/hibernate.cfg.xml b/src/it/tutorials/osgi/unmanaged-native/src/main/resources/hibernate.cfg.xml
deleted file mode 100644 (file)
index f367c53..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!DOCTYPE hibernate-configuration PUBLIC
-"-//Hibernate/Hibernate Configuration DTD//EN"
-"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
-<hibernate-configuration>
-    <session-factory>
-        <property name="hibernate.connection.driver_class">org.h2.Driver</property>
-        <property name="hibernate.connection.url">jdbc:h2:mem:db_unmanaged_native;DB_CLOSE_DELAY=-1;MVCC=TRUE</property>
-        <property name="hibernate.connection.username">sa</property>
-        <property name="hibernate.connection.password"></property>
-        <property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
-        <property name="hibernate.hbm2ddl.auto">create-drop</property>
-        
-        <!-- <property name="hibernate.connection.pool_size">5</property>
-               <property name="hibernate.c3p0.min_size">50</property>
-               <property name="hibernate.c3p0.max_size">800</property>
-               <property name="hibernate.c3p0.max_statements">50</property>
-               <property name="hibernate.jdbc.batch_size">10</property>
-               <property name="hibernate.c3p0.timeout">300</property>
-               <property name="hibernate.c3p0.idle_test_period">3000</property>
-               <property name="hibernate.c3p0.testConnectionOnCheckout">true</property> -->
-               
-               <!-- <property name="hibernate.connection.pool_size">5</property>
-               <property name="hibernate.jdbc.batch_size">10</property>
-               <property name="hibernate.connection.provider_class">proxool</property>
-               <property name="hibernate.proxool.properties">pool-one.properties</property>
-               <property name="hibernate.proxool.pool_alias">pool-one</property> -->
-               
-               <!-- <property name="hibernate.cache.region_prefix">hibernate.test</property>
-               <property name="cache.use_query_cache">true</property>
-        <property name="cache.use_second_level_cache">true</property>
-        <property name="cache.use_structured_entries">true</property>
-        <property name="cache.region.factory_class">org.hibernate.cache.EhCacheRegionFactory</property>
-        <property name="net.sf.ehcache.configurationResourceName">file:///[PATH]/unmanaged-jpa/src/main/resources/ehcache.xml</property> -->
-    
-        <!-- <property name="hibernate.cache.region_prefix">hibernate.test</property>
-               <property name="cache.use_query_cache">true</property>
-        <property name="cache.use_second_level_cache">true</property>
-        <property name="cache.use_structured_entries">true</property>
-        <property name="cache.region.factory_class">org.hibernate.cache.infinispan.InfinispanRegionFactory</property> -->
-        
-        <mapping class="org.hibernate.osgitest.entity.DataPoint"/>
-    </session-factory>
-</hibernate-configuration>
diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/resources/pool-one.properties b/src/it/tutorials/osgi/unmanaged-native/src/main/resources/pool-one.properties
deleted file mode 100644 (file)
index 0a372bd..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-jdbc-0.proxool.alias=pool-one
-jdbc-0.proxool.driver-url=jdbc:h2:mem:db_unmanaged_native;DB_CLOSE_DELAY=-1;MVCC=TRUE
-jdbc-0.proxool.driver-class=org.h2.Driver
-jdbc-0.user=sa
-jdbc-0.password=
-jdbc-0.proxool.maximum-connection-count=2
-jdbc-0.proxool.house-keeping-test-sql=select CURRENT_DATE
diff --git a/src/it/tutorials/pom.xml b/src/it/tutorials/pom.xml
deleted file mode 100644 (file)
index e899e4c..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <groupId>org.hibernate.tutorials</groupId>
-    <artifactId>hibernate-tutorials</artifactId>
-    <version>4.3.9.Final</version>
-    <packaging>pom</packaging>
-
-    <name>Hibernate Getting Started Guide Tutorials</name>
-    <description>Aggregator for the Hibernate tutorials presented in the Getting Started Guide</description>
-
-    <properties>
-        <!-- Skip artifact deployment -->
-        <maven.deploy.skip>true</maven.deploy.skip>
-    </properties>
-
-    <modules>
-        <module>basic</module>
-        <module>annotations</module>
-        <module>entitymanager</module>
-        <module>envers</module>
-        <module>osgi/unmanaged-native</module>
-        <module>osgi/unmanaged-jpa</module>
-        <module>osgi/managed-jpa</module>
-    </modules>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-core</artifactId>
-            <version>4.3.9.Final</version>
-        </dependency>
-
-        <!-- Hibernate uses jboss-logging for logging, for the tutorials we will use the sl4fj-simple backend -->
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
-            <version>1.7.12</version>
-        </dependency>
-
-        <!-- The tutorials use JUnit test cases to illustrate usage -->
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.12</version>
-        </dependency>
-
-        <!-- The tutorials use the H2 in-memory database -->
-        <dependency>
-            <groupId>com.h2database</groupId>
-            <artifactId>h2</artifactId>
-            <version>1.4.187</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <testResources>
-            <testResource>
-                <filtering>false</filtering>
-                <directory>src/test/java</directory>
-                <includes>
-                    <include>**/*.xml</include>
-                </includes>
-            </testResource>
-            <testResource>
-                <directory>src/test/resources</directory>
-                <filtering>true</filtering>
-            </testResource>
-        </testResources>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.3</version>
-                <configuration>
-                    <source>1.6</source>
-                    <target>1.6</target>
-                    <encoding>utf8</encoding>
-                    <showWarnings>true</showWarnings>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
diff --git a/src/it/tutorials/schema-annotations.sql b/src/it/tutorials/schema-annotations.sql
deleted file mode 100644 (file)
index 48eb18e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-    create table EVENTS (
-        id bigint not null,
-        EVENT_DATE timestamp,
-        title varchar(255),
-        primary key (id)
-    );
diff --git a/src/it/tutorials/schema-basic.sql b/src/it/tutorials/schema-basic.sql
deleted file mode 100644 (file)
index c5e2c0e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-    create table EVENTS (
-        EVENT_ID bigint not null,
-        EVENT_DATE timestamp,
-        title varchar(255),
-        primary key (EVENT_ID)
-    );
diff --git a/src/it/tutorials/schema-entitymanager.sql b/src/it/tutorials/schema-entitymanager.sql
deleted file mode 100644 (file)
index 48eb18e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-    create table EVENTS (
-        id bigint not null,
-        EVENT_DATE timestamp,
-        title varchar(255),
-        primary key (id)
-    );
diff --git a/src/it/tutorials/schema-envers.sql b/src/it/tutorials/schema-envers.sql
deleted file mode 100644 (file)
index ecec80e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-
-    create table EVENTS (
-        id bigint not null,
-        EVENT_DATE timestamp,
-        title varchar(255),
-        primary key (id)
-    );
-
-    create table EVENTS_AUD (
-        id bigint not null,
-        REV integer not null,
-        REVTYPE tinyint,
-        EVENT_DATE timestamp,
-        title varchar(255),
-        primary key (id, REV)
-    );
-
-    create table REVINFO (
-        REV integer generated by default as identity,
-        REVTSTMP bigint,
-        primary key (REV)
-    );
-
-    alter table EVENTS_AUD 
-        add constraint FK5cembm6xahf542q8e4h0pq2t1 
-        foreign key (REV) 
-        references REVINFO;
diff --git a/src/it/tutorials/schema-osgi-managed-jpa.sql b/src/it/tutorials/schema-osgi-managed-jpa.sql
deleted file mode 100644 (file)
index de92e46..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-create sequence hibernate_sequence start with 1 increment by 1;
-
-    create table DataPoint (
-        id bigint not null,
-        name varchar(255),
-        primary key (id)
-    );
diff --git a/src/it/tutorials/schema-osgi-unmanaged-jpa.sql b/src/it/tutorials/schema-osgi-unmanaged-jpa.sql
deleted file mode 100644 (file)
index de92e46..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-create sequence hibernate_sequence start with 1 increment by 1;
-
-    create table DataPoint (
-        id bigint not null,
-        name varchar(255),
-        primary key (id)
-    );
diff --git a/src/it/tutorials/schema-osgi-unmanaged-native.sql b/src/it/tutorials/schema-osgi-unmanaged-native.sql
deleted file mode 100644 (file)
index d89e280..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-create sequence hibernate_sequence start with 1 increment by 1;
-
-    create table DataPoint (
-        id bigint not null,
-        name varchar(255),
-        primary key (id)
-    );
-
-    create table DataPoint_AUD (
-        id bigint not null,
-        REV integer not null,
-        REVTYPE tinyint,
-        name varchar(255),
-        primary key (id, REV)
-    );
-
-    create table REVINFO (
-        REV integer generated by default as identity,
-        REVTSTMP bigint,
-        primary key (REV)
-    );
-
-    alter table DataPoint_AUD 
-        add constraint FK43jw6b5mtbfxur0xhyjxynbea 
-        foreign key (REV) 
-        references REVINFO;
diff --git a/src/it/tutorials/verify.bsh b/src/it/tutorials/verify.bsh
deleted file mode 100644 (file)
index 9156c4a..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-import de.juplo.test.FileComparator;
-
-
-FileComparator comparator = new FileComparator(basedir);
-
-if (!comparator.isEqual("schema-annotations.sql","annotations/target/create.sql"))
-  return false;
-if (!comparator.isEqual("schema-basic.sql","basic/target/create.sql"))
-  return false;
-if (!comparator.isEqual("schema-entitymanager.sql","entitymanager/target/create.sql"))
-  return false;
-if (!comparator.isEqual("schema-envers.sql","envers/target/create.sql"))
-  return false;
-if (!comparator.isEqual("schema-osgi-managed-jpa.sql","osgi/managed-jpa/target/create.sql"))
-  return false;
-if (!comparator.isEqual("schema-osgi-unmanaged-jpa.sql","osgi/unmanaged-jpa/target/create.sql"))
-  return false;
-if (!comparator.isEqual("schema-osgi-unmanaged-native.sql","osgi/unmanaged-native/target/create.sql"))
-  return false;