On 5/16/05, Laurie Harper <[EMAIL PROTECTED]> wrote:
> Hi, I have a problem which may be a bug in the OJB xdoclet plugin and/or
> in OJB itself. Or I'm doing something wrong, of course ;-) Can anyone
> shed any light?
> 
> I have a persistent class with a static inner class which is also
> persistent. The outer class holds a collection of instances of the inner
> class. Both are marked up with xdoclet tags, so I have something like this:
> 
> /**
>   * @ojb.class
>   */
> public class History {
>      /**
>       * @ojb.class
>       */
>      public static class Change {
>          // change log info...
>      }
> 
>      /**
>       * @ojb.collection foreignkey="..."
>       *         element-class-ref="...History$Change"
>       */
>      private List changes;
> }
> 
> The first problem is that xdoclet chokes on the '$' in the
> element-class-ref, givig the error "Collection changes in class
> ...History references an unknown class ...History$Change." That's legal
> syntax for an inner class, so I'd call that a bug... Would I be wrong?
> 
> Secondly, if I change the '$' to '.', the repository is generated OK but
> OJB chokes on startup, throwing a ClassNotFoundException for
> ...History.Change. I thought both '.' and '$' were legal ways to
> reference an inner class; is OJB at fault here, or is the '.' syntax
> really not allowed?
> 
> If I manually edit the generated repository_user.xml and change the
> references to Change to use '$', it works, so I know my mappings are
> otherwise correct.
> 
> So:
> - is xdoclet (or the OJB plugin) at fault for not accepting the '$' form?
> - is OJB at fault for not accepting the '.' form?
> - Am *I* at fault for doing something wrong?

This is probably a mixture of errors of OJB and XDoclet. OJB requires
a $ in the classname because the classloader otherwise throws an error
(you'll have to ask Sun why that is so). However this won't work so
good with XDoclet as it uses the source itself rather than the
classloader to find classes so it requires the dot notation (as the
Java Language spec defines).
Could you please create an issue in the JIRA
(http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10700)
with some sample code etc. I'll have a look at it then.

regards,
Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to