Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:3
This is a pretty basic question I would think...(not sure why it won't work)
Say I've got a simple mapping document that starts off like this:
Code:
<hibernate-mapping>
<class name="myClass" table="myFirstTable">
<id name="firstID" type="string" column="ID">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>
...etc. etc. might have some simple properties.
Then the mapping (same document) also has a property that's a list of Strings that come from a related table, like this:
Code:
<list name="relatedStrings"
table="mySecondTable"
where="typeCode = 'someType'">
<key column="foreignKeyID"/>
<element column="myContent" type="String"/>
</list>
I can generate a "myClass" class from this and I can read instances of it from the tables no problem.
-BUT-
When I add a couple of strings to the "relatedStrings" list and go to try and
save the new object - NOTHING. No errors but no new table data either.
Am I wrong to assume that if my mapping document succeeds in pulling data from the table it ought to also be able to write new data back?
(even if the new data is some extra elements of a list generated from a related table?)
Or do the components of the list (unlike String) NEED to be separately mapped classes themselves (with their own mapping documents)?
It seems odd that it works in one direction but not the other.
Any ideas would be most helpful!
E