... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)

2005-01-14

Hibernate

Here are some general Hibernate gotchas:

  • Property names that begin or end with an underscore give Hibernate grief.  It issues error messages that it cannot find properties that exist.  In the case I was trying, the identifiers were all caps (other than the underscores).  Perhaps it works for identifiers in normal Java case?
  • When trying to use Oracle LONG columns, Hibernate would issue the error message 'Stream has already been closed' when trying to materialize the containing objects.  This only occurs when the containing objects have container relationships to other objects.  This error usually occurs in JDBC when ResultSet columns are not read in left-to-right order and an attempt is made to backtrack to a LONG column.  An inspection of the Hibernate code suggests that this is a possibility.  The Hibernate forums contain references to this problem, but no-one has posted a solution.  I tried changing the mapping so that a LONG property appears:
    • as the last property for a class -- no effect.
    • in a new class mapped as a self-join to the table, with a one-to-one relationship to the original class -- this worked, but further testing is needed to verify that it works in all scenarios.  Also, this mapping does not work for updates since Hibernate will think that a new row needs to be created.
    • in a new component class -- no effect.

Blog Archive