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]