package com.peterphi.std.guice.hibernate.webquery.discriminatortest;

import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(discriminatorType = DiscriminatorType.STRING)
abstract class MyBaseObject
{
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long id;


	@Override
	public String toString()
	{
		return getClass().getSimpleName() + "{" +
		       "id=" + id +
		       '}';
	}
}

@@ -67,98 +67,8 @@
 t;%0A%0A
-import javax.persistence.DiscriminatorColumn;%0Aimport javax.persistence.DiscriminatorType;%0A
 impo
@@ -96,16 +96,16 @@
 Entity;%0A
+
 import j
@@ -344,16 +344,327 @@
 JOINED)%0A
+// DiscriminatorColum has been commented out to work around a bug in Hibernate - see https://hibernate.atlassian.net/browse/HHH-9501%0A// A Discriminator is not required for this functionality in our library, but I've left this reference here to make it easier to figure%0A// Out what's going wrong in the future%0A//
 @Discrim

Work around Hibernate bug https://hibernate.atlassian.net/browse/HHH-9501 where a DiscriminatorColum and DiscriminatorValue being used results in invalid SQL being generated for SELECT queries that specify a particular subclass (appears to impact HSQLDB dialect in Hibernate 4.2.x and 4.3.x)