You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Ali Ibrahim <ai...@vecna.com> on 2003/04/09 18:08:43 UTC
OJB questions
Hello,
I had a couple of questions I though someone could answer for me.
1. Why do you have to declare both the key and object variables for
references?
e.g.
public class A
{
Integer breferenceId;
B breference;
}
It seems like you should be able to find the key inside the object
reference. Maybe I am missing something though.
2. Is there some better documentation of the SQL that should be
generated for the various types of inheritance + references? The
tutorials cover the structure of the repository.xml very well, but there
is little information on what cascade or foriegn key settings OJB
expects if any.
3. After reading the documentation I realized that auto-delete did NOT
correspond to a database cascade. Possibly this could be made more
clear. I assume you expect users to set cascade settings themselves in
the SQL code (it might nice if OJB could also have settings to do this
programatically, especially since the sql cascades can affect the
integrity of the cache).
4. Is there a way to set tell a broker and only that broker to use a
certain cache? I know you can have a per-broker cache, but it would be
nice to have more control of cache so you could have session-level
caching across broker objects.
5. What happens you proxy an object in an inheritance hierarchy? Are you
forced to proxy all the classes in the hierarchy? If not, how do you
deal with the issues of resolving objects from the interface class?
6. I have coded a small example in OJB with inheritance, single and
collection references, and proxies and it has worked well. We are also
thinking of using Hibernate. What are some of the differences between
OJB and Hibernate? (nicely of course).
Thank You.
--
Ali Ibrahim
Vecna Technologies
Email: aibrahim@vecna.com
W: (301)864-7253
Date Query
Posted by Cory L Hubert <ch...@alloy.com>.
This should be simple question :)
For some reason this query by date isn't working. The date is a
java.sql.Date. It's on SQLServer2000 using the OPTA2000 Driver.
====
PersistenceBroker broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
broker.beginTransaction();
Criteria c = new Criteria();
System.out.println("date :" + d.toString());
c.addEqualToColumn("event_day", d.toString());
QueryByCriteria query = new QueryByCriteria(Event.class, c);
Collection e = broker.getCollectionByQuery(query);
broker.commitTransaction();
=====
I concated the date like this.
Calendar cal = Calendar.getInstance();
cal.clear();
cal.set(Calendar.MONTH, 3); // really 4 since Jan is 0
cal.set(Calendar.DATE, 7);
cal.set(Calendar.YEAR, 2003);
Date d = new Date(cal.getTime().getTime());
======
And the record in the db is a SQLServer DATETIME filed
2003-04-07 00:00:00.000
-----Original Message-----
From: Larry Schuler [mailto:larryas2@yahoo.com]
Sent: Wednesday, April 09, 2003 5:34 PM
To: OJB Users List
Subject: Re: OJB questions
Hi Ali,
You asked:
> 1. Why do you have to declare both the key and object variables for
> references?
> e.g.
>
> public class A
> {
>
> Integer breferenceId;
>
> B breference;
>
> }
>
> It seems like you should be able to find the key inside the object
> reference. Maybe I am missing something though.
I asked this same question a week or so ago, unfortunately no one responded,
I
ended up adding the dual refs to my objects, but I'm still wondering how
synchronization will be maintained :(
> 6. I have coded a small example in OJB with inheritance, single and
> collection references, and proxies and it has worked well. We are also
> thinking of using Hibernate. What are some of the differences between
> OJB and Hibernate? (nicely of course).
For our use, we had to abandon hibernate because of it's need for a index
field
for all collections. We have a lot of small arrays in our pre-existing
objects
and we didn't like having to create an index for each array in the db.
Otherwise, hibernate seems similar, but the more I work with OJB, the
happier I
am we started using it - just my opinion.
--Larry
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: OJB questions
Posted by Larry Schuler <la...@yahoo.com>.
Hi Ali,
You asked:
> 1. Why do you have to declare both the key and object variables for
> references?
> e.g.
>
> public class A
> {
>
> Integer breferenceId;
>
> B breference;
>
> }
>
> It seems like you should be able to find the key inside the object
> reference. Maybe I am missing something though.
I asked this same question a week or so ago, unfortunately no one responded, I
ended up adding the dual refs to my objects, but I'm still wondering how
synchronization will be maintained :(
> 6. I have coded a small example in OJB with inheritance, single and
> collection references, and proxies and it has worked well. We are also
> thinking of using Hibernate. What are some of the differences between
> OJB and Hibernate? (nicely of course).
For our use, we had to abandon hibernate because of it's need for a index field
for all collections. We have a lot of small arrays in our pre-existing objects
and we didn't like having to create an index for each array in the db.
Otherwise, hibernate seems similar, but the more I work with OJB, the happier I
am we started using it - just my opinion.
--Larry