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 Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br> on 2003/06/10 21:32:20 UTC

Re: Some Problem about OJB]

Hi!

Xiaxin, your are right at your point of view.

All the following text are IMHO:

In a OOP we always try to get objects before inserting and/or updating. Why?

1) Best end user experience. Users like when the app fill as many data as
possible;

2) Selects are always less "harmfull" to database then starting a
transaction, trying an insert/update, the rollbacking the transaction.

So, I always drive my users to work "query" oriented. Ask the system for
data you think is already there. For a small company, having 80000 clients
in a table shows that almost all common clients will be there. I'll drive
the user to search in several ways for the right one before driving he to
put a new client on db.

Yes, I understand that are several approachs due to focus of your system.

But I think that OJB should not change their behavior...


Thanks for ear me.



Edson Richter


----- Original Message ----- 
From: "Thomas Mahler" <th...@web.de>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Tuesday, June 10, 2003 3:55 PM
Subject: [Fwd: Some Problem about OJB]




-------- Original Message --------
Subject: Some Problem about OJB
Date: Wed, 11 Jun 2003 0:39:17 +0800
From: xiaxin <xi...@wizvision.com>
To: thma@apache.org <th...@apache.org>

thma,hi:
OJB is a great project I had never seen in the world.
but a little problem? :-)

When I insert a record which maybe had already been inserted before. in
tradional way
the database will return a Exception such as "The primary Key constrain
violated ".

but in ojb, if I use store method, then the record will be updated if
already in database,
then , should I first query then go to store it ??

this way may be very inefficient.

Then how can I get rid off this inefficient?

Thanks a lot!


        xiaxin
        xiaxin@wizvision.com
          2003-06-11





---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.488 / Virus Database: 287 - Release Date: 5/6/2003



Re: Some Problem about OJB]

Posted by Thomas Mahler <th...@web.de>.
I agree with Carlos!

If you prefer to try an insert and to react on an exceptio in case of a
failure you can still do it with OJB:

just use
broker.store(object, ObjectModificationDefaultImpl.INSERT)

the ObjectModification parameter will tell OJB to use an INSERT without
prior checking!

cheers,
thomas