With a single-table inheritance model, there seems to be no way, using RawSql to map the discriminator column. From the Google Group:
I have an abstract entity and 2 subclasses in a single table with a discriminator column/value set. All is well for standard API queries. I am using RawSqlBuilder.unparsed(sql) for a complex case. I'm getting an error:
javax.persistence.PersistenceException: Inheritance type for discriminator value  was not found?
(FWIW, 170 is the primary key of the entity to be instantiated.)
I've made various attempts to include the discriminator column in the query. How does one go about specifying/selecting/mapping the discriminator value for an unparsed (or parsed for that matter) RawSql?
It could be that you can't. I don't recall a test case for this so its likely a bug where you can't specify/map the discriminator.