emmanuel wrote:
but Map are not really something useful from a elational POV. You probably can workaround and avoid using it.
Actually, I had been trying to deal with maps using something like this example:
Code:
@Entity(access = AccessType.FIELD)
@Inheritance(
strategy=InheritanceType.SINGLE_TABLE,
discriminatorType=DiscriminatorType.STRING
)
public class TestBundle
{
@ManyToMany(cascade = CascadeType.ALL)
@MapKey
@Column(name = "`testCases`")
private Map<String, TestCase> testCases = new HashMap<String, TestCase>();
...
}
But no matter what I did, some of the SQL generated would always contain a "formula" referring to a column that didn't exist. As far as I understood, this was supposed to be used as a discriminator. (I originally did not have the @Inheritance annotation at the top, but adding it did not seem to change whether this "formula" got created.) I don't see the need for a discriminator in my case, though maybe I misunderstand something -- in any case, I could not make this formula go away, and so my load operations were always failing because of requests for this column.
When I searched for errors similar to mine (on the Hibernate site including forum, in JIRA, on the web in general), I didn't find someone in exactly the same situation, but did find several admonitions that map support wasn't implemented yet.
But maybe I was closer to the right incantation than I thought? That would be great. I don't really want to have to use the hbm files at all....