Hi,
for some cases this could be a solution. But the majority needs the
texts in all available languages, so the user can edit the description
in these languages at once.
Regards
Claus
Am Mo, 2003-12-08 um 12.01 schrieb Antonio Gallardo:
> Hi Claus:
>
> Maybe this is not your solution, but are you tried PB using
> QueryByIdentity? If the table has a 2 fields as PK, then you can easily
> do:
>
> public Text retrieve(Integer id, Integer language, PersistenceBroker pb)
> {
> Text criteria = new Text();
> criteria.setId(id);
> criteria.setLanguage(language);
> Query query = new QueryByIdentity(criterio);
> Text result = (Text) pb.getObjectByQuery(query);
> return result;
> }
>
> I think it would not have a penality at all, will go directly to the
> language you need.
> This would help?
>
> Best Regards,
>
> Antonio Gallardo
>
>
> Claus Radloff dijo:
> > Hi,
> >
> > this does not solve the problem for me, because it works on already
> > loaded instances of a class. My problem is, that I can't load my class
> > with OJB, because the table I use to store these objects is not fully
> > normalized (for performance reasons). So instead of one bean, OJB will
> > probably return several beans to me. Since this table is referenced by
> > nearly every other table, it would be very important to me, to integrate
> > it with OJB.
> >
> > The table looks like this:
> >
> > table texts
> > id | name | type | language | text
> > ----+-----------+------+----------+-----------------------
> > 1 | Warning | WARN | 1 | Warning in english
> > 1 | Warning | WARN | 2 | Warning in german
> > 2 | Hello | TEXT | 1 | Hello
> > 2 | Hello | TEXT | 2 | Hallo
> >
> > The class looks like this:
> >
> > class Text
> > {
> > Integer id;
> > String name;
> > String type;
> > Map texts;
> > }
> >
> > The Map uses the language id as the key.
> >
> > So, if I used instance callbacks, I would get two beans for each text
> > element, right?
> >
> > Normalizing this table into two tables isn't possible either, as it
> > would result in poor performance.
> >
> > The easiest thing for me would be to implement my own storage classes,
> > but I can't find a way to specify that.
> >
> >
> > Regards
> >
> > Claus
> >
> >
> >
> > Thomas Mahler wrote:
> >> The most easy approach is to use instance callbacks.
> >> See http://db.apache.org/ojb/tutorial3.html#instance%20callbacks.
> >>
> >> you can place the additional lookup logic into the afterLookup callback
> >> The storage logic can be placed in the afterInsert callback.
> >>
> >> Only "disadvantage" of this approach: you persistent class must
> >> implement the OJB interface PersistenceBrokerAware.
> >>
> >> cheers,
> >> Thomas
> >>
> >> Claus Radloff wrote:
> >> > Hello,
> >> >
> >> > I´d like to provide OJB with my own class to load/store objects in the
> >> > database. This is because I can´t get OJB to load this kind of beans,
> >> as
> >> > they consist of multiple rows in the same table.
> >> >
> >> > To be able to load other classes with OJB, which reference these
> >> > objects, I would like to tell OJB somehow to use my own
> >> implementation.
> >> > Is there a possibility to do so?
> >> >
> >> > What I imagine is something like:
> >> > <class-descriptor
> >> > class="my.SpecialBean"
> >> > storage-class="my.SpecialBeanStorage"/>
> >> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
Mit freundlichem Gru� / kind regards
Claus Radloff
Siemens Business Services GmbH & Co. OHG
SBS D SOL SCS BAI, Nbg vdT
Tel. +49 911 654 3349
Fax +49 911 654 6560
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]