> On Thu, Jun 24, 2010 at 1:45 PM, Matthew Adams <[email protected]>wrote:
> Instead of a virtual entity, you could create the view and tell > >> OpenJPA about the view via @JoinTable annotations... > > (apologies if this is a double post - I seem to have a problem using the right return address...) Matthew, I'm wondering if you can give a few more details here. It seems pretty straightforward, yet OpenJPA is throwing an exception. So A has a field for E where the relationship is defined by a view. Suppose the view is named logical.a_e with FK columns a_id, and e_id. > A:E from an ER-perspective is a many-to-one. I'd prefer this to be unidirectional, though I'd be willing to make it bidirectional. > So I define A.e something like this: > @ManyToOne(fetch = FetchType.LAZY) > @JoinTable(schema = "logical", name = "a_e", > joinColumns = @JoinColumn(name = "a_id"), > inverseJoinColumns = @JoinColumn(name = "e_id") > ) > private E e; > I'm not real fluent with @JoinTable. I've tried other variations. It's throwing something like this: > Caused by: <openjpa-1.2.2-r422266:898935 fatal user error> org.apache.openjpa.persistence.ArgumentException: > You have supplied columns for "yadda.yadda.A.e <element:class java.lang.Object>", but this mapping cannot have columns in this context. > I searched on this error and it seems there may be a problem with ManyToOne and JoinTable. I don't really understand what I found. I tried SecondaryTable but since A.e is nullable, this doesn't seem to be the right solution. > I'm using OpenJPA 1.2.1. > Thanks. > -- > Daryl Stultz > _____________________________________ > 6 Degrees Software and Consulting, Inc. > http://www.6degrees.com > http://www.opentempo.com mailto:[email protected]
