how to determine "other" when "Only one may be defined as writable"

View: New views
3 Messages — Rating Filter:   Alert me  

how to determine "other" when "Only one may be defined as writable"

by Ernie Rael :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I added
    @OneToOne
    private Event event;
to an Enity and got
    Exception [EclipseLink-48] (Eclipse Persistence Services - 2.0.0.v20090821-r4934): org.eclipse.persistence.exceptions.DescriptorException
    Exception Description: Multiple writable mappings exist for the field [ERNIE.ASPECTGROUP.EVENT_ID].  Only one may be defined as writable, all others must be specified read-only.
    Mapping: org.eclipse.persistence.mappings.OneToOneMapping[event]
    Descriptor: RelationalDescriptor(org.metawb.astro.db.Aspectgroup --> [DatabaseTable(ERNIE.ASPECTGROUP)])

adding
        @JoinColumn( nullable = false, insertable = false, updatable = false)
fixed the problem of course. But I'd like to know what "other" mapping has this field as writable. I turned on logging but I didn't see anything obvious. Is there a way to get this info. I took a look at the Metamodel API but gave up when I saw:
    The metamodel API may be extended to cover object/relational mapping
    information in a future release of this specification.

-ernie

Re: how to determine "other" when "Only one may be defined as writable"

by James Sutherland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The error means you have another Basic or OneToOne mapping the same column.  Please include you mappings (annotations).

Re: how to determine "other" when "Only one may be defined as writable"

by Ernie Rael :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> error means you have another Basic or OneToOne mapping the same column.

OK. I was hoping there is/was some way to turn on other logging/degug info (I'm using JPA-2.0-M7 eclipselink, I tried LogLevel.FINEST). I'm sure this won't be that last time I'd like to disect things, and this seems a simple example to start with. I'll take a more careful look and include the mappings if I'm stuck. Thanks.

I'm new to JPA (DB as well, but that's another issue) and I want to get a good feeling for what's going on.