r705 - in hibernate-list-idx-bug: . src/main/java/org/nuiton/entities src/main/resources/org/nuiton/entities src/test/java/org/nuiton/entities src/test/resources
Author: dcosse Date: 2014-04-23 18:24:25 +0200 (Wed, 23 Apr 2014) New Revision: 705 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/705 Log: cleaning Modified: hibernate-list-idx-bug/LICENSE.txt hibernate-list-idx-bug/README.txt hibernate-list-idx-bug/changelog.txt hibernate-list-idx-bug/pom.xml hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Building.java hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Flat.java hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Loft.java hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Suite.java hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Building.hbm.xml hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Flat.hbm.xml hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Loft.hbm.xml hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Suite.hbm.xml hibernate-list-idx-bug/src/test/java/org/nuiton/entities/AppTest.java hibernate-list-idx-bug/src/test/resources/hibernate.cfg.xml Property changes on: hibernate-list-idx-bug/LICENSE.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: hibernate-list-idx-bug/README.txt =================================================================== --- hibernate-list-idx-bug/README.txt 2014-04-23 15:53:09 UTC (rev 704) +++ hibernate-list-idx-bug/README.txt 2014-04-23 16:24:25 UTC (rev 705) @@ -1,5 +1,4 @@ -Test case for https://hibernate.atlassian.net/browse/HHH-8109 - +Test case for bug on Hibernate union-subclass HOWTO ----- Property changes on: hibernate-list-idx-bug/README.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Property changes on: hibernate-list-idx-bug/changelog.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: hibernate-list-idx-bug/pom.xml =================================================================== --- hibernate-list-idx-bug/pom.xml 2014-04-23 15:53:09 UTC (rev 704) +++ hibernate-list-idx-bug/pom.xml 2014-04-23 16:24:25 UTC (rev 705) @@ -22,7 +22,7 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>Test case for ???</name> + <name>Test case for bug on Hibernate union-subclass</name> <inceptionYear>2014</inceptionYear> <licenses> @@ -96,12 +96,6 @@ <version>${hibernateVersion}</version> </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-entitymanager</artifactId> - <version>${hibernateVersion}</version> - </dependency> - <!-- Other libraries --> <dependency> <groupId>org.slf4j</groupId> @@ -109,17 +103,6 @@ <version>1.7.6</version> </dependency> - <dependency> - <groupId>javassist</groupId> - <artifactId>javassist</artifactId> - <version>3.12.1.GA</version> - </dependency> - - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - <!-- Tests --> <dependency> <groupId>junit</groupId> Property changes on: hibernate-list-idx-bug/pom.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Building.java =================================================================== --- hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Building.java 2014-04-23 15:53:09 UTC (rev 704) +++ hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Building.java 2014-04-23 16:24:25 UTC (rev 705) @@ -1,5 +1,29 @@ package org.nuiton.entities; +/* + * #%L + * Test case for bug on Hibernate union-subclass + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2014 Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; Property changes on: hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Building.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Flat.java =================================================================== --- hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Flat.java 2014-04-23 15:53:09 UTC (rev 704) +++ hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Flat.java 2014-04-23 16:24:25 UTC (rev 705) @@ -1,5 +1,29 @@ package org.nuiton.entities; +/* + * #%L + * Test case for bug on Hibernate union-subclass + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2014 Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + import java.io.Serializable; /** Property changes on: hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Flat.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Loft.java =================================================================== --- hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Loft.java 2014-04-23 15:53:09 UTC (rev 704) +++ hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Loft.java 2014-04-23 16:24:25 UTC (rev 705) @@ -1,4 +1,28 @@ package org.nuiton.entities; + +/* + * #%L + * Test case for bug on Hibernate union-subclass + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2014 Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ import java.io.Serializable; /** Property changes on: hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Loft.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Suite.java =================================================================== --- hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Suite.java 2014-04-23 15:53:09 UTC (rev 704) +++ hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Suite.java 2014-04-23 16:24:25 UTC (rev 705) @@ -1,5 +1,29 @@ package org.nuiton.entities; +/* + * #%L + * Test case for bug on Hibernate union-subclass + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2014 Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + import java.io.Serializable; /** Property changes on: hibernate-list-idx-bug/src/main/java/org/nuiton/entities/Suite.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Building.hbm.xml =================================================================== --- hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Building.hbm.xml 2014-04-23 15:53:09 UTC (rev 704) +++ hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Building.hbm.xml 2014-04-23 16:24:25 UTC (rev 705) @@ -1,4 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Test case for bug on Hibernate union-subclass + $Id$ + $HeadURL$ + %% + Copyright (C) 2014 Code Lutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + 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 General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + <hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping" xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping classpath://org/hibernate/hibernate-mapping-4.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Property changes on: hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Building.hbm.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Flat.hbm.xml =================================================================== --- hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Flat.hbm.xml 2014-04-23 15:53:09 UTC (rev 704) +++ hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Flat.hbm.xml 2014-04-23 16:24:25 UTC (rev 705) @@ -1,4 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Test case for bug on Hibernate union-subclass + $Id$ + $HeadURL$ + %% + Copyright (C) 2014 Code Lutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + 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 General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + <hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping" xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping classpath://org/hibernate/hibernate-mapping-4.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Property changes on: hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Flat.hbm.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Loft.hbm.xml =================================================================== --- hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Loft.hbm.xml 2014-04-23 15:53:09 UTC (rev 704) +++ hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Loft.hbm.xml 2014-04-23 16:24:25 UTC (rev 705) @@ -1,4 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Test case for bug on Hibernate union-subclass + $Id$ + $HeadURL$ + %% + Copyright (C) 2014 Code Lutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + 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 General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + <hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping" xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping classpath://org/hibernate/hibernate-mapping-4.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Property changes on: hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Loft.hbm.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Suite.hbm.xml =================================================================== --- hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Suite.hbm.xml 2014-04-23 15:53:09 UTC (rev 704) +++ hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Suite.hbm.xml 2014-04-23 16:24:25 UTC (rev 705) @@ -1,4 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Test case for bug on Hibernate union-subclass + $Id$ + $HeadURL$ + %% + Copyright (C) 2014 Code Lutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + 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 General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + <hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping" xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping classpath://org/hibernate/hibernate-mapping-4.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Property changes on: hibernate-list-idx-bug/src/main/resources/org/nuiton/entities/Suite.hbm.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: hibernate-list-idx-bug/src/test/java/org/nuiton/entities/AppTest.java =================================================================== --- hibernate-list-idx-bug/src/test/java/org/nuiton/entities/AppTest.java 2014-04-23 15:53:09 UTC (rev 704) +++ hibernate-list-idx-bug/src/test/java/org/nuiton/entities/AppTest.java 2014-04-23 16:24:25 UTC (rev 705) @@ -15,24 +15,23 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * + * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ -import com.google.common.collect.Lists; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; -import org.hibernate.service.ServiceRegistryBuilder; import org.junit.Assert; import org.junit.Test; import javax.persistence.PersistenceException; +import java.util.ArrayList; import java.util.List; public class AppTest { @@ -46,41 +45,40 @@ ServiceRegistry serviceRegistry = serviceRegistryBuilder.applySettings( configuration.getProperties()).build(); SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry); - org.hibernate.Session sess = sessionFactory.openSession(); + org.hibernate.Session session = sessionFactory.openSession(); Loft loft = new Loft(); loft.setName("L-A"); // Create and persist a suite instance - Transaction tx = sess.beginTransaction(); - Long loftKey = (Long)sess.save(loft); + Transaction tx = session.beginTransaction(); + Long loftKey = (Long) session.save(loft); System.out.println("loftKey:" + loftKey); Suite suite = new Suite(); suite.setName("S-A"); // Create and persist a suite instance - Long suiteKey = (Long)sess.save(suite); + Long suiteKey = (Long) session.save(suite); System.out.println("suiteKey:" + suiteKey); tx.commit(); - tx = sess.beginTransaction(); + tx = session.beginTransaction(); Building building = new Building(); building.setName("B-A"); - List<Flat> flats = Lists.newArrayList(); + List<Flat> flats = new ArrayList(); building.setFlats(flats); flats.add(loft); flats.add(suite); - Long buildingKey = (Long)sess.save(building); + Long buildingKey = (Long) session.save(building); System.out.println("buildingKey:" + buildingKey); - try { tx.commit(); Assert.fail("Failed but should not"); } catch (PersistenceException pe) { - sess.close(); + session.close(); } } Property changes on: hibernate-list-idx-bug/src/test/java/org/nuiton/entities/AppTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: hibernate-list-idx-bug/src/test/resources/hibernate.cfg.xml =================================================================== --- hibernate-list-idx-bug/src/test/resources/hibernate.cfg.xml 2014-04-23 15:53:09 UTC (rev 704) +++ hibernate-list-idx-bug/src/test/resources/hibernate.cfg.xml 2014-04-23 16:24:25 UTC (rev 705) @@ -1,4 +1,28 @@ <?xml version='1.0' encoding='utf-8'?> +<!-- + #%L + Test case for bug on Hibernate union-subclass + $Id$ + $HeadURL$ + %% + Copyright (C) 2014 Code Lutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + 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 General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> @@ -6,15 +30,17 @@ <hibernate-configuration> <session-factory> + <!-- Database connection settings --> <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> + <!-- Echo all executed SQL to stdout --> <property name="show_sql">true</property> <property name="hbm2ddl.auto">update</property> - <!--Liste des fichiers de Mapping hbm --> + <!--Mappings hbm --> <mapping resource="org/nuiton/entities/Building.hbm.xml"/> <mapping resource="org/nuiton/entities/Flat.hbm.xml"/> <mapping resource="org/nuiton/entities/Loft.hbm.xml"/> Property changes on: hibernate-list-idx-bug/src/test/resources/hibernate.cfg.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native
participants (1)
-
dcosse@users.nuiton.org