Are you considering generification of OJB?
It would be nice to inherit from ManageableCollection, for instance.
Thanks!
David
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
What do you recommend - should I redesign my model to make it not
dependent on being informed whenewer an object completely materialized?
Thanks.
David
David Zejda wrote:
Mhmm, two things:
* Are you sure that the thing object is actually stored in the db,
i.e. is there a row for it after the
Mhmm, two things:
* Are you sure that the thing object is actually stored in the db, i.e.
is there a row for it after the store call ?
As I'm currently testing it on HSQLDB, there is the script [with most of
ojb internal parts cut off]:
CREATE TABLE SALE(A_ID INTEGER NOT NULL PRIMARY KEY,THING_I
The PersistenceBrokerAware is a special case of listener, so you
probably would get the same behaviour. But why is it not working for you
? Depending on what you're interested in, you override afterUpdate and
afterLookup. The latter is called when you traverse the collection via
the iterator's
The solution was to replace
org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
with
org.apache.ojb.broker.cache.ObjectCacheEmptyImpl, so now it goes OK:
Ugh.
The seeming of connection between the objectcache and the order of
initialization steps was only a result of a bug in my testcase, so the
pro
The initialization-method is called from the
RowReaderDefaultImpl#readObjectFrom method as the last step, right after
the field values have been set. The references and collections are read
later, so if you require them, you'll have to either supply a Listener
for PB events to the PersistenceBr
like this approach (due to the persistency layer
"invading" your domain objects) - I am not one of them.
HTH,
Chaeers,
-Original Message-----
From: David Zejda [mailto:[EMAIL PROTECTED]
Sent: 26 July 2004 09:59
To: OJB Users List
Subject: how to postinitialize objects after being com
Imagine, you use the DummyCalendar in Calendar2DateFieldConversion.
javaToSql will be ok.
(... if (source instanceof Calendar) ...)
but sqlToJava will materialize not the DummyCalendar (that you need),
but a GregorianCalendar.
(... GregorianCalendar cal = new GregorianCalendar()...)
public cla
standard implemenation for equals(). see
Effective Java by Josh Bloch.
jakob
David Zejda schrieb:
I think, it would be better to use something like
((source != null) && (source.getClass()==Calendar.class))
{
...
in conversion strategies than
if (source instanceof Calendar)
{
...
Thanks for your testcase.
Imagine, you use the DummyCalendar in Calendar2DateFieldConversion.
javaToSql will be ok.
(... if (source instanceof Calendar) ...)
but sqlToJava will materialize not the DummyCalendar (that you need),
but a GregorianCalendar.
(... GregorianCalendar cal = new GregorianC
...
David
Guillaume
-Message d'origine-----
De : David Zejda [mailto:[EMAIL PROTECTED]
Envoye : samedi 24 juillet 2004 07:59
A : OJB Users List
Objet : little suggestion about "instanceof"
I think, it would be better to use something like
((source != null) && (source.getClass
Thanks, Thomas & Charles...
I'll try it out.
David
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
I have a custom row reader able to initialize materialized objects by
their _postinit() methods. Essentially it works, but there is a problem
- the _postinit() should be called after the object is materialized
completely, i.e. with all fields, but also references and collections
filled. So, I guess
I think, it would be better to use something like
((source != null) && (source.getClass()==Calendar.class))
{
...
in conversion strategies than
if (source instanceof Calendar)
{
...
to avoid reducing e.g. custom Calendar subclass to Calendar during
conversion.
David
--
Use
conversion="org.apache.ojb.broker.accesslayer.conversions.StringList2VarcharFieldConversion"
or
conversion="org.apache.ojb.broker.accesslayer.conversions.StringVector2VarcharFieldConversion"
or
create your own conversion strategy.
/**
* @ojb.field jdbc-type="VARCHAR"
*conversion
I have a custom row reader able to initialize materialized objects by
their _postinit() methods. Essentially it works, but there is a problem
- the _postinit() should be called after the object is materialized
completely, i.e. with all fields, but also references and collections
filled. So, I g
Sorry - it seems that the bug is elsewhere - in a controller being used
to manage persistence, so don't fiddle it more..
One way or another, thanks for your suggestion to use Integers instead
of ints as a type for keys..
David
Thanks for a quick reply.
I corrected the classes as you suggested, b
You shouldn't use the primarykey of We as the foreignkey for the
instance of Subject. The foreignkey will be filled with the primarykey
value of the Subject instance when you store the We object and it has an
associated Subject object.
Instead add an additional field to the We class, e.g. int su
What's wrong with the classes below?
The "We" instance loaded from db has "master_id" property set correctly,
but the "we" property is null.
public class Subject
{
/**
* Artificial ID key holder
*
* @ojb.field nullable="false"
*autoincrement="ojb"
*
SCENARIO:
There are 2 classes:
abstract class Abstract
class Sub extends Abstract
where Abstract contains collection of Sub type.
PROBLEM:
There are foreign-key tags missing in Torque schema generated by XDoclet.
EXAMPLE:
/**
* @ojb.class include-inherited="true"
*/
public class Sub extends Abstr
abstract A
interface B
AB1 extends A implements B
AB2 extends A implements B
AB3 extends A
B1 implements B
and I need both extents A and B, to have references to both "A" and "B"
types.
Will OJB manage such scenario or should I redesign the model?
E.g. plug the classes under A hierarchy? Would it
It's much more comfortable to find the missing p/keys now, thanks..
David
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Thomas Dudziak wrote:
David Zejda wrote:
You have a missing quotation mark for the collection-class attribute,
thanks for a quick reply - sorry about my blindness
No problem, happens to all of us :-)
Btw, I don't think that TreeSet works as the collection-class, you
should use one o
You have a missing quotation mark for the collection-class attribute,
thanks for a quick reply - sorry about my blindness
Btw, I don't think that TreeSet works as the collection-class, you
should use one of the classes provided by OJB. Same for using SortedSet
as the variable type - you have to
I need bidirectional 1:n relation, but I'm still mising something...
Please, have a look on a two simple classes.
package oit.ucase;
/**
* @ojb.class include-inherited="true"
*table="USECASE_HIERARCHY"
*/
public class Deposit
{
/**
* Artificial ID key holder
*
* @o
The main problem with tables denormalised to contain more real world
entities is possibility to fill unrelated fields (e.g. both from Group
and Role). But if you let the persistency completely on mapping tool
(OJB), you don't have to worry about it - OJB will not mangle them..
The main remainin
Marcus Young wrote:
Each class is mapped to a separate table.
I persuaded, that it's much easier to map the whole hierarchy to one
table and provide ojbConcreteClass..
David
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additio
The classes I sent you yesterday don't go through the xdoclet succesfully
although I'm using the newly downloaded jars.
But maybe I have the bad jars? - their sfv checksum is in attachment.
Thanks
David
> David Zejda wrote:
>
> > The problem with pk/fk unfortunately rem
> > > >Maybe it's the problem - I declared them (pk, ojbConcreteClass) in
the
> > > >abstract class and referenced the interface.
> > > >
> > > This could also explain the error about the different number of PKs
vs.
> > FKs.
> > > As a general rule, every class that is referenced by a persistent
>
> >My scenario is simple:
> >
> >MyInterface
> >MyAbstractClass implements MyInterface
> >MyClass extends MyAbstractClass
> >(and a few more subclasses)
> >
> >where
> >
> >-all of them are provided with ojb.class, mapped to the same table
> >-MyAbstractClass contains artificial primary key and ojb
I have classes A, B, both with artificial id's as a primary keys.
If I nest A into B, should I override primary key of nested object (A)
somehow to disable its primary-keyness in the nesting class (B)?
Thanks.
David
-
To unsubsc
B Users List" <[EMAIL PROTECTED]>
Odesláno: 28. cervna 2004 12:07
Predmet: Re: (xdoclet -> torque) with reference to interface
> David Zejda wrote:
>
> >Do I need factory-class/factory-method if I have ojbConcreteClass?
> >I thougt, if the ojbConcreteClass is provi
/viewcvs.cgi/*checkout*/db-ojb/lib/xdoclet-ojb-module-1.2.1.jar
http://cvs.apache.org/viewcvs.cgi/*checkout*/db-ojb/lib/xjavadoc-1.0.3.jar
, other libs are from rc6. Should I try OJB rc7? Or current snapshot of
whole OJB?
Thanks
David
> David Zejda wrote:
>
> >Remains roughly the same.
> Generating repository descriptors for interfaces works without problems,
> but you should be aware of some things when using this at runtime. E.g.
> you probably need factory-class/factory-method and perhaps
ojbConcreteClass.
Do I need factory-class/factory-method if I have ojbConcreteClass?
I t
-> torque) with reference to interface
> David Zejda wrote:
>
> >I provided several (cca 20) more xdoclet ojb.class tags and appropriate
> >ojb.fields, ojb.collections, ojb.references... Repository is being
created
> >OK, but the torque schema fails. I'm not sure, wh
I guess, auto-update="true" may help.
David
- Puvodní zpráva -
Od: "Morley, Liam " <[EMAIL PROTECTED]>
Komu: "OJB Users List" <[EMAIL PROTECTED]>
Odesláno: 27. cervna 2004 9:01
Predmet: storing objects with nested objects
I have 3 separate objects: A, B, and C. A has a collection of B,
Odesláno: 26. cervna 2004 20:20
Predmet: Re: (xdoclet -> torque) with reference to interface
> David Zejda wrote:
>
> > I had a class with reference:
> >
> > * @ojb.reference class-ref="oit.agree.Agreement"
> > *foreignkey="
I had a class with reference:
* @ojb.reference class-ref="oit.agree.Agreement"
*foreignkey="agreement_id"
*auto-retrieve="true"
*auto-update="false"
*auto-delete="false"
and referenced interface (with no ojb
Is it possible, to have a ?
With this repos (produced from XDoclet) it throws "Integrity constraint
violation":
Thanks for your suggestions..
David
-
To unsubscri
I have a project, where both object and relational model changes with a new
release. Currently I use XDoclet to generate both repository and SQL (via
Torque). Is there any way to generate SQL DDL able to update table
structures to accomodate them to a new object model, preserving data? Or
should I
I have a
class Email
/**
* @ojb.field
*/
private Date date;
...
transformed into repository
and after calling broker.store() it says:
SQL failure while insert object data for class oit.Email, PK of the given
object
is [ id=1], object was [EMAIL PROTECTED], exception mess
is it possible to specify custom row reader for a whole project or for a
connection?
thanks
David
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
42 matches
Mail list logo