There is a problem with using a single mapping (no entity-names) solution to read and write data back to the database, even using the formula tag for the columns/table we don't want to write back. The key that is specified inside of our join tag is the foreign key to the static data table we are joining with, not the primary key to the dynamic table to which we want to write. So when Hibernate constructs the SQL to update the dynamic data table, it is using the wrong key.
What we were trying to do was use two mappings - one to read, and one to write using the entity-name to distinguish between them. The read mapping works just fine without the entity-name, but not with it, apparently because of the join. The write mapping works fine for reading and writing, but it would only read data from one table and we need data from two. Our object is composed of data from two tables, but we will only ever want to update one of the two tables.
|