Re: Problem relationship with 2 eomodels
Pierre G <[email protected]> Fri, 30 Oct 2009 01:13:11 -0700 (PDT)
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
I found the way to make it work in awakeFromFetch of EntityBFromModel1.
I had to set the id used for the to-one relationship in the class and I was
abled to fetch the corresponding EntityCFromModel2 :
public void awakeFromFetch(EOEditingContext ec)
{
EntityCFromModel2 entC =
(EntityCFromModel2)EOUtilities.objectWithPrimaryKeyValue(ec,"EntityCFromModel2",
idForRelation());
}
better idea ?
Pierre Gilquin-2 wrote:
>
>
> Hi all,
>
> I have 2 eomodels one using MySql and the second
> Oracle.
>
> I have the following Entities : EntityAFromModel1,
> EntityBFromModel1and EntityCFromModel2
> EntityAFromModel1 has a to-many relationship with
> EntityBFromModel1.
> EntityBFromModel1 has a to-one relationship
> with EntityCFromModel2. This relation crosses the 2 models.
>
> When fetching EntityAFromModel1, I get the
> following error when accessing the to-one relationship to
> EntityCFromModel2 :
> java.lang.IllegalStateException: Server exception:
> The object with globalID _EOIntegralKeyGlobalID[EntityCFromModel2
> (java.lang.Integer)16823]could not be found in the database. This could be
> result of a referential integrity problem with the database. An empty
> fault
> could not be created because the object's class could not be determined
> (e.g.
> the GID is temporary or it is for an abstract entity).
>
> No SQL statement is send to the Oracle
> Database.
>
> The only thing I find for help is to fetch all
> EntityCFromModel2 at the Application start. But it is not very practical
> has
> EntityCFromModel2 has a lot of instances. Moreover, I am sure that it will
> still
> work a long time after the start.
>
> I thought also to implement awakeFromFetch in
> EntityBFromModel1 in order to fetch the instance needed for the
> relationship but
> without success.
>
>
> Do you have a better idea to make this relationship
> works between 2 models working ?
>
>
> Thank in advance.
>
> Pierre
> WO 5.2.4
> _________________________________________________________________
>
>
--
View this message in context: http://old.nabble.com/Problem-relationship-with-2-eomodels-tp26109808p26116207.html
Sent from the WebObjects-Dev mailing list archive at Nabble.com.