Index: D:/workspaces/hibernate-ganymede/hibernateext_tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmToolTest.java =================================================================== --- D:/workspaces/hibernate-ganymede/hibernateext_tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmToolTest.java (revision 0) +++ D:/workspaces/hibernate-ganymede/hibernateext_tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmToolTest.java (revision 0) @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2007-2008 Red Hat, Inc. + * Distributed under license by Red Hat, Inc. All rights reserved. + * This program is made available under the terms of the + * Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributor: + * Red Hat, Inc. - initial API and implementation + ******************************************************************************/ +package org.hibernate.tool.hbm2x.hbm2hbmxml; + +import org.hibernate.mapping.JoinedSubclass; +import org.hibernate.mapping.PersistentClass; +import org.hibernate.mapping.RootClass; +import org.hibernate.mapping.SingleTableSubclass; +import org.hibernate.mapping.Subclass; +import org.hibernate.mapping.UnionSubclass; +import org.hibernate.tool.hbm2x.Cfg2HbmTool; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * @author Dmitry Geraskov + * + */ +public class Cfg2HbmToolTest extends TestCase { + + public void testNeedsTable(){ + Cfg2HbmTool c2h = new Cfg2HbmTool(); + PersistentClass pc = new RootClass(); + assertTrue(c2h.needsTable(pc)); + assertTrue(c2h.needsTable(new JoinedSubclass(pc))); + assertTrue(c2h.needsTable(new UnionSubclass(pc))); + assertFalse(c2h.needsTable(new Subclass(pc))); + assertFalse(c2h.needsTable(new SingleTableSubclass(pc))); + } + + public static Test suite() { + return new TestSuite(Cfg2HbmToolTest.class); + } + +} Property changes on: D:\workspaces\hibernate-ganymede\hibernateext_tools\src\test\org\hibernate\tool\hbm2x\hbm2hbmxml\Cfg2HbmToolTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Author Id Revision Date Name: svn:eol-style + native Index: D:/workspaces/hibernate-ganymede/hibernateext_tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmAllTests.java =================================================================== --- D:/workspaces/hibernate-ganymede/hibernateext_tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmAllTests.java (revision 16054) +++ D:/workspaces/hibernate-ganymede/hibernateext_tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmAllTests.java (working copy) @@ -19,6 +19,7 @@ suite.addTest(InheritanceTest.suite()); suite.addTest(SetElementTest.suite()); suite.addTest(BackrefTest.suite()); + suite.addTest(Cfg2HbmToolTest.suite()); //$JUnit-END$ return suite; } Index: D:/workspaces/hibernate-ganymede/hibernateext_tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java =================================================================== --- D:/workspaces/hibernate-ganymede/hibernateext_tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java (revision 16054) +++ D:/workspaces/hibernate-ganymede/hibernateext_tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java (working copy) @@ -17,12 +17,10 @@ import org.hibernate.engine.query.sql.NativeSQLQueryReturn; import org.hibernate.engine.query.sql.NativeSQLQueryRootReturn; import org.hibernate.mapping.Any; -import org.hibernate.mapping.Backref; import org.hibernate.mapping.Collection; import org.hibernate.mapping.Column; import org.hibernate.mapping.Component; import org.hibernate.mapping.Formula; -import org.hibernate.mapping.IndexBackref; import org.hibernate.mapping.JoinedSubclass; import org.hibernate.mapping.ManyToOne; import org.hibernate.mapping.OneToMany; @@ -390,8 +388,8 @@ public boolean needsTable(PersistentClass clazz) { - return !(clazz instanceof org.hibernate.mapping.Subclass - && clazz instanceof org.hibernate.mapping.SingleTableSubclass); + return !((clazz instanceof SingleTableSubclass) || + ((clazz != null) && (clazz.getClass() == Subclass.class))); } public boolean isSubclass(PersistentClass clazz) {