> Thanks for your quick response!
>
[quoted text clipped - 4 lines]
> hibernate.properties file and this has not added any further info to
> the error messages.
Thanks for sending over your mappings! I have a few suggestions:
1) Check that the database column 'town' really does exist.
2) Remove 'lazy=true' from the class definition. I think you can only
switch _off_ laziness for a whole class.
3) Remove the 'outer-join=true' from the many-to-one entries. IIRC it's
not supported there (any more?).
4) Remove the 'insert' and 'update' entries, because they default true
anyway.
If none of that helps, next:
5) Disable laziness explicitly with 'lazy=false' on the many-to-one
5) Look into your cascades - why aren't you cascading events on that
class? Is there some particular reason for that? If so, are you making
sure you persist and update everything as required by the Company class?
If not, set cascade 'all' for now.
6) Comment out the 'town' property in Address.hbm.xml, to see if you still
get the problem. If so, it's likely the problem is actually a symptom of a
more specific problem loading that column from the database.
6) Set the property 'hibernate.show_sql' in either the config or your
hibernate properties. This will make hibernate output the SQL statements
it's about to execute to System.out. Look for the commands it executes
leading upto the problem. If nothing immediately seems wrong with it, fire
up the mysql console and try those same commands with some test data.
Unfortunately in my experience theres usually some trial and error
involved with fixing any reasonably complex hibernate model, and it's
often the performance optimizations that cause problems. IMHO there are
too many conditional features in hibernate, in that you can do this, but
only if you're doing this, and this, and not doing something else, so the
approach I usually use is to build the model incrementally, starting with
the very basics, and then gradually building in optimizations and stuff,
always checking each change still works.
> If it helps, we also have another class 'CorporateAccount' which has an
> address, and this initializes properly.
Good. The Address mapping itself looks okay (apart from the redundancy
mentioned above). Try comparing the way you've mapped the address from
there to see if anything's done differently.
Hopefully this will at least give a more descriptive error to work on ;)

Signature
Ross Bamford - rosco@roscopeco.remove.co.uk