memory leak

2004-07-29 Thread ZZZ Liu
Hi,

I am writing a tool to import data into database and 
I am using OJB 1.0 as the persistence layer to do the
actual insertion/update into database. I found that I
will get OutOfMemoryError problem if I load a large
number (over 100, will commit for each file) of files'
data. It works fine if I only load a small number of
files. Did anybody encounter this problem before? Is
there any known issue regarding OJB memory usage?

Thanks in advance,
Zhe


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Found unclosed resources while finalize

2004-07-29 Thread ZZZ Liu
Hi,

I am using OJB 1.0.

I found following message appeared a lot of times in 
my log file. Could anybody tell me what does that mean
and what would cause that problem?

29 Jul 2004 20:27:43 5408  INFO  [Finalizer]
accesslayer.ReportQueryRsIterator - Found unclosed
resources while finalize (causer class:
org.apache.ojb.broker.accesslayer.ReportQueryRsIterator)
Do automatic cleanup

Thanks in advance,
Zhe




__
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FW: save point support

2004-07-12 Thread ZZZ Liu
Hi, Mahler

Thanks for your reply. Currently we use PB API. Is it
possible to use OTM with PB. Are there any examples I
can follow?

Thanks,
Zhe

> -Original Message-
> From: Mahler Thomas
> [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 12, 2004 2:27 AM
> To: 'OJB Users List'
> Subject: RE: save point support
> 
> 
> Hi Zhe,
> 
> It depends on the API you use.
> 
> PB and JDO Transactions do not provide checkpoints.
> But ODMG and OTM do:
> 
> org.apache.ojb.otm.core.Transaction.checkpoint() 
> org.odmg.Transaction.checkpoint()
> 
> cheers,
> Thomas
> 
> > -Original Message-
> > From: ZZZ Liu [mailto:[EMAIL PROTECTED]
> > Sent: Friday, July 09, 2004 6:52 PM
> > To: [EMAIL PROTECTED]
> > Subject: save point support
> > 
> > 
> > Hi,
> > 
> > Just wondering that whether OJB has save point
> support
> > so that partial transaction can be rolled back?
> > 
> > Thanks,
> > Zhe
> > 
> > 
> > 
> > __
> > Do you Yahoo!?
> > New and Improved Yahoo! Mail - Send 10MB messages!
> > http://promotions.yahoo.com/new_mail 
> > 
> >
>
-
> > 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]
> 
> 
> 




__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



save point support

2004-07-11 Thread ZZZ Liu
Hi,

Just wondering that whether OJB has save point support
so that partial transaction can be rolled back?

Thanks,
Zhe



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Does OJB support FK on UK?

2004-06-10 Thread ZZZ Liu
In Oracle, we can create a foreign key reference to a
unique constraint instead of the primary key. Could
anybody tell me that whether OJB supports that? I
tried but looks like OJB always tries to find the
primary key columns of the parent table, even though
the foreign key actually is setup on a unique key.

Thanks,
Zhe




__
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Is it platform independant if I use upper() and like '%'?

2004-04-01 Thread ZZZ Liu
Hi All,

I am using ojb as the persistence layer and assume
that I don't need to re-write my code if I need to
switch to a different database. However, if I use 

Criteria crit = new Criteria();
crit.addEqualTo("upper(firstname)", "TOM");
crit.addLike("firstname", "T%");

Is it still platform independant?

Thanks in advance for you reply.

Zhe


__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FW: FW: setStartAtIndex/setEndAtIndex for a very large result set

2004-02-04 Thread ZZZ Liu
Hi,

This is a repost. Could anybody help me on that?

Thanks,
Zhe

--- Zhe Liu <[EMAIL PROTECTED]> wrote:
> 
> 
> -Original Message-----
> From: ZZZ Liu [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 03, 2004 3:46 PM
> To: [EMAIL PROTECTED]
> Subject: Re: FW: setStartAtIndex/setEndAtIndex for a
> very large result
> set
> 
> 
> After more investigation by looking into OJB code, I
> found that the out of memory problem occurs in
> org.apache.ojb.broker.accesslayer.RsIterator.size()
> method. In that method, there are two ways to get
> size:
> 1) count
> 2) .last .getRow
> 
> I found that 2) will give me out of memory error.I
> tried that with pure JDBC and also got out of memory
> error. However, if I force to use 1), it works fine.
> I
> am using Oracle 9i. I am worndering whether there is
> any way to solve this problem. Currently I have to
> set
> jdbc-level="1.0" instead of "2.0" to force 1) is
> used.
> 
> Thanks,
> Zhe
>  
> 
> > 
> > -Original Message-
> > From: ZZZ Liu [mailto:[EMAIL PROTECTED]
> > Sent: Monday, February 02, 2004 9:01 PM
> > To: [EMAIL PROTECTED]
> > Subject: setStartAtIndex/setEndAtIndex for a very
> > large result set
> > 
> > 
> > Hi, All
> > 
> > I am trying to do a simple query against a very
> > large
> > table with over 200,000 records. I use
> > QueryByCriteria
> > without any criteria, but settiing
> > setStartAtIndex(1)
> > and setEndAtIndex(2). Then I use
> getIteratorByQuery
> > to
> > get the result. However, I got OutOfMemory error.
> > 
> > I tried the same thing on a relatively small table
> > (about 100 records) and it works fine.
> > 
> > Could anybody shed some light on this?
> > 
> > Thanks,
> > Zhe
> > 
> > __
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free web site building tool.
> > Try it!
> > http://webhosting.yahoo.com/ps/sb/
> > 
> >
>
-
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> > 
> 
> 
> __
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool.
> Try it!
> http://webhosting.yahoo.com/ps/sb/
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FW: How to set null for a column for which the corresponding java type is long

2004-02-03 Thread ZZZ Liu
Thanks a lot for all of your answers. I just realized
that OJB can convert from JDBC types to Number
(Integer, Long, BigInteger,BigDecimal) automatically.
For example, JDBC type BIGINT can be converted to
either primitive long or Object Long without any
FieldConversion. In this case, I can just use Long
instead of long to solve the problem. 

Just wondering anybody can update the document
http://db.apache.org/ojb/jdbc-types.html to make that
explicit?

Thanks,
Zhe

> 
> 
> -Original Message-
> From: Martin Kalén [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 28, 2004 1:04 AM
> To: OJB Users List
> Subject: Re: How to set null for a column for which
> the corresponding
> java type is long
> 
> 
> Danilo Tommasina wrote:
> 
> >> I have a data base column. The data type is
> number
> >> (10). It is nullable. The JDBC type defined in
> >> repository is BIGINT and the corresponding java
> type
> >> is long (default). Can anybody tell me how to
> save a
> >> record so that the value of that column is null
> >> instead of zero?
> >
> > Do not use a primitive data type in your
> persistent class, use instead a
> >  subtype of Number. (Integer, Long, BigInteger,
> BigDecimal,... )
> 
> Or; if you don't have control over the bean or want
> to keep long, use a
> field conversion class that converts long values of
> 0 as NULL.
> 
> There are quite a few pre-packaged field conversion
> classes that come
> with OJB, they can be found in the package:
> org.apache.ojb.broker.accesslayer.conversions
> 
> The Int2IntegerFieldConversion class can be used as
> a template for how
> to write a field conversion for a long with
> 0-inserts as NULL.
> 
> See
>
http://cvs.apache.org/viewcvs.cgi/*checkout*/db-ojb/src/java/org/apache/ojb/
>
broker/accesslayer/conversions/Int2IntegerFieldConversion.java?content-type=
> text%2Fplain&rev=1.3
> 
> 
> To use field conversions, specify them in your
> repository. Eg:
> 
> 
>jdbc-type="{x}"
>
>
conversion="com.mycompany.PrimitiveLong2LongFieldConversion"/>
> 
> 
> HTH,
>   Martin
> 
> --
> Martin Kalén
> Curalia AB  Web:  http://www.curalia.se
> Orrspelsvägen 2BMail: [EMAIL PROTECTED]
> SE-182 79  StocksundTel:  +46-8-410 064 40
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FW: setStartAtIndex/setEndAtIndex for a very large result set

2004-02-03 Thread ZZZ Liu
After more investigation by looking into OJB code, I
found that the out of memory problem occurs in
org.apache.ojb.broker.accesslayer.RsIterator.size()
method. In that method, there are two ways to get
size:
1) count
2) .last .getRow

I found that 2) will give me out of memory error.I
tried that with pure JDBC and also got out of memory
error. However, if I force to use 1), it works fine. I
am using Oracle 9i. I am worndering whether there is
any way to solve this problem. Currently I have to set
jdbc-level="1.0" instead of "2.0" to force 1) is used.

Thanks,
Zhe
 

> 
> -Original Message-
> From: ZZZ Liu [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 02, 2004 9:01 PM
> To: [EMAIL PROTECTED]
> Subject: setStartAtIndex/setEndAtIndex for a very
> large result set
> 
> 
> Hi, All
> 
> I am trying to do a simple query against a very
> large
> table with over 200,000 records. I use
> QueryByCriteria
> without any criteria, but settiing
> setStartAtIndex(1)
> and setEndAtIndex(2). Then I use getIteratorByQuery
> to
> get the result. However, I got OutOfMemory error.
> 
> I tried the same thing on a relatively small table
> (about 100 records) and it works fine.
> 
> Could anybody shed some light on this?
> 
> Thanks,
> Zhe
> 
> __
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool.
> Try it!
> http://webhosting.yahoo.com/ps/sb/
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



setStartAtIndex/setEndAtIndex for a very large result set

2004-02-02 Thread ZZZ Liu
Hi, All

I am trying to do a simple query against a very large
table with over 200,000 records. I use QueryByCriteria
without any criteria, but settiing setStartAtIndex(1)
and setEndAtIndex(2). Then I use getIteratorByQuery to
get the result. However, I got OutOfMemory error.

I tried the same thing on a relatively small table
(about 100 records) and it works fine.

Could anybody shed some light on this?

Thanks,
Zhe

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Performance difference between mapping number column to long vs BigDecimal

2004-01-27 Thread ZZZ Liu
Hi, all

I am trying to know the performance difference between
mapping number column to long vs BigDecimal. I did
following test.

1) I loaded over 200k records in the table.
2) I ran a test to retrieve all records in the table
as an iterator and then loop over the iterator to get
each element and assign it to a value object.
3) It took 145 seconds, if all number fields are
defined as DECIMAL/BigDecimal.
4) I changed one column, which is the primary key of
this table to BIGINT/long and ran the same test. It
took 109 seconds.
5) I changed two more non-primary key columns to
BIGINT/long. It took 105 seconds.
6) I changed the primary key column back to
DECIMAL/BigDecimal, but leave the other two as
BIGINT/long. It took 134 seconds.

>From the test, looks like BIGINT/long is faster than
DECIMAL/BigDecimal. But I still have two questions.

1) Why the difference is bigger for primary column?
2) Is the above test result what you expected? Can
anybody explain the reson behind the scene.

Any help would be much appreciated.

Thanks,
Zhe


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to set null for a column for which the corresponding java type is long

2004-01-27 Thread ZZZ Liu
Hi, All

I have a data base column. The data type is number
(10). It is nullable. The JDBC type defined in
repository is BIGINT and the corresponding java type
is long (default). Can anybody tell me how to save a
record so that the value of that column is null
instead of zero?

Thanks,
Zhe

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FW: deploy OJB with web application

2004-01-25 Thread ZZZ Liu
Armin.

Thanks for your reply. We found the problem. It is
because resin has it's own XML parser which is not
exactly the same as apache's. And when resin starts,
it loads its own library before loading from
WEB-INF/lib. The problem can be solved by explicitly
putting xerces.jar in the classpath.

Thanks,
Zhe

> 
> 
> -Original Message-
> From: Armin Waibel [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 22, 2004 3:28 AM
> To: OJB Users List
> Subject: Re: deploy OJB with web application
> 
> 
> Hi,
> 
> ZZZ Liu wrote:
> > I am using OJB rc5. Everything is fine when I use
> it
> > for stand alone program. But when I try to use it
> in a
> > web application (applciation server is resin
> 2.1.10),
> > I got following error. From the log, we can see
> that
> > there is a NullPointerException at
> >
>
org.apache.ojb.broker.metadata.RepositoryXmlHandler.getIsoLevel(Unknown
> > Source) and from the debug message we can see that
> > isolation-level: null.
> >
> 
> hmm, think something wrong with your
>  >
>
file:/D:/gsnx/builds/hourly/dist/gsnx/conf/repository.xml
> file.
> 
> Should be something like that:
> 
> 
>  isolation-level="read-uncommitted"
>  proxy-prefetching-limit="50">
> 
>  
>  &database;
> 
>  
>  &internal;
> 
>  
>  &user;
> 
> 
> regards,
> Armin
> 
> > If I manually add isolation-level attribute to
> each
> > class descriptor element in
> repository_internal.xml
> > and all included repository_user.xml's, then it
> works.
> >
> >
> > I don't think there is any document saying that we
> > need to change repository_internal.xml. I am
> wondering
> > whether anybody has ever had the same problem and
> > what's the real cause and the soultion for it.
> >
> > Thanks in advance.
> >
> > Zhe
> >
> >
>
===
> > 84938 DEBUG [tcpConnection-9003-0]
> util.RequestUtils -
> > Get module name for path
> > /core/domain/party/partySearchReport.jsp
> > 84938 DEBUG [tcpConnection-9003-0]
> util.RequestUtils -
> > Module name found: default
> > 84953 DEBUG [tcpConnection-9003-0] tiles.InsertTag
> -
> > insert page='/core/fwk/mainLayout.jsp'.
> > 88953 INFO  [tcpConnection-9003-0]
> > util.PropertyMessageResources - Initializing,
> >
> config='org.apache.struts.taglib.html.LocalStrings',
> > returnNull=true
> >
> [org.apache.ojb.broker.metadata.RepositoryPersistor]
> > INFO: OJB Descriptor Repository:
> >
>
file:/D:/gsnx/builds/hourly/dist/gsnx/conf/repository.xml
> >
>
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
> > DEBUG: startDoc
> >
>
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
> > DEBUG:  proxy-prefetching-limit: null
> >
>
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
> > DEBUG:  > descriptor-repository
> >
>
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
> > DEBUG: < documentation
> >
>
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
> > DEBUG:   > class-descriptor
> >
>
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
> > DEBUG:  isolation-level: null
> > 89719 DEBUG [tcpConnection-9003-0] tiles.InsertTag
> -
> > [ServletException in:/core/fwk/mainLayout.jsp]
> null'
> > java.lang.ExceptionInInitializerError
> > at
> >
>
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKey(Un
> known
> > Source)
> > at
> >
>
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersisten
> ceBroker(Unknown
> > Source)
> > at
> >
>
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unkn
> own
> > Source)
> > at
> >
>
com.gsnx.core.server.persistence.ojb.OjbPersistenceManager.(OjbPersist
> enceManager.java)
> > at
> >
>
com.gsnx.core.server.persistence.PersistenceManagerFactory.getPersistenceMan
> ager(PersistenceManagerFactory.java)
> > at
> >
>
com.gsnx.core.server.util.lang.TranslationUtil.cacheTranslation(TranslationU
> til.java)
> > at
> >
>
com.gsnx.core.server.util.lang.TranslationUtil.getTranslation(TranslationUti
> l.java)
> > at
> >
>
com.gsnx.core.server.util.lang.TranslationUtil.message(TranslationUtil.java)
> > at
> >
>
com.gsnx.core.server.util.lang.TranslationUtil.message(Trans

Re: FW: FW: FW: Cannot retrieve back just saved objects without committing transaction

2004-01-22 Thread ZZZ Liu
Thanks a lot. I will try later.

Zhe
> 
> 
> -Original Message-
> From: Armin Waibel [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 21, 2004 12:38 AM
> To: OJB Users List
> Subject: Re: FW: FW: Cannot retrieve back just saved
> objects without
> committing transaction
> 
> 
> Hi Zhe,
> 
> ZZZ Liu wrote:
> > Hi, Armin
> >
> > Thank you very much for the fixing. But I have one
> > more question. If the batch mode is turned on by
> > calling
> >
> broker.getConnectionManager().setBatchMode("true"),
> db
> > operations will not be applied to
> > db until transaction is commited. In this case, I
> will
> > still have the problem if I want to insert two
> records
> > in a batch and then retrieve them back right away
> > without committing the transaction.
> > This looks
> > differen from JDBC. After
> > PreparedStatement.executeBatch, even the
> transaction
> > is not commited, I believe I can still retrieve
> them
> > back. Is there any paticular reason for the OJB
> batch
> > mode implementation?
> 
> Works in the same way as pur JDBC. You have to call
> PB.serviceConnectionManager.executeBatch()
> to execute the batch without committing the tx.
> 
> regards,
> Armin
> 
> >
> > Thanks,
> > Zhe
> >
> >
> >
> >>-Original Message-
> >>From: Armin Waibel [mailto:[EMAIL PROTECTED]
> >>Sent: Sunday, January 18, 2004 8:57 AM
> >>To: OJB Users List
> >>Subject: Re: FW: Cannot retrieve back just saved
> >>objects without
> >>committing transaction
> >>
> >>
> >>Hi Zhe,
> >>
> >>I add your test case to test suite and fix the
> >>problem in CVS head. It
> >>will be included in upcoming 1.0.
> >>You can easy fix it by changing one line in
> >>ConnectionManagerImpl - see
> >>below.
> >>
> >>Thank you very much for test case and detailed
> >>description.
> >>
> >>regards,
> >>Armin
> >>
> >>
> >>RCS file:
> >>
> >
> >
>
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/ConnectionManage
> >
> >>rImpl.java,v
> >>   retrieving revision 1.9
> >>   retrieving revision 1.10
> >>   diff -u -r1.9 -r1.10
> >>   --- ConnectionManagerImpl.java   2 Nov 2003
> >>13:21:08 -  1.9
> >>   +++ ConnectionManagerImpl.java   18 Jan 2004
> >>16:47:35 -  1.10
> >>   @@ -101,7 +101,14 @@
> >>this.jcd =
> >>
> >
> >
>
MetadataManager.getInstance().connectionRepository().getDescriptor(pbKey);
> >
> >>this.connectionFactory =
> >>
> >
> >
>
ConnectionFactoryFactory.getInstance().createConnectionFactory();
> >
> >>this.platform =
> >>PlatformFactory.getPlatformFor(jcd);
> >>   -setBatchMode(this.jcd.getBatchMode());
> >>   +/*
> >>   +by default batch mode is not enabled
> and
> >>after use of a PB
> >>   +instance, before instance was returned
> >>to pool, batch mode
> >>   +was set to false again (PB
> >>implementation close method)
> >>   +Be carefully in modify this behaviour,
> >>changes could cause
> >>   +unexpected behaviour
> >>   +*/
> >>   +setBatchMode(false);
> >>}
> >>
> >>
> >>
> >>ZZZ Liu wrote:
> >>
> >>>It is a standalone program and the database is
> >>
> >>Oracle.
> >>
> >>>Here is the sample code:
> >>>
> >>>Product product = new Product();
> >>>product.setProductCode("AAA");
> >>>product.setDesc("BBB");
> >>>
> >>>PersistenceBroker broker = null;
> >>>try
> >>>{
> >>>broker =
> >>>
> >>
>
>>PersistenceBrokerFactory.defaultPersistenceBroker();
> >>
> >>>broker.beginTransaction();
> >>>// assuming "AAA" is a new record that does
> >>
> >>not
> >>
> >>>exist in database
> >>>broker.store(product,
> >>>ObjectModificationDefaultImpl.INSERT);
> >>>
> >>>Query query = new
> >>
> >>QueryByCriteria(Product.class,
> >>
> >>>null);
> >>>C

Re: FW: deploy OJB with web application

2004-01-22 Thread ZZZ Liu
Armin,

Thanks for your reply.

Here is a portion of my repository.xml. I am not sure
whether the missing attribute for
proxy-prefetching-limit causes the problem?



&database;

&internal;

Thanks,
Zhe

> 
> 
> -Original Message-
> From: Armin Waibel [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 22, 2004 3:28 AM
> To: OJB Users List
> Subject: Re: deploy OJB with web application
> 
> 
> Hi,
> 
> ZZZ Liu wrote:
> > I am using OJB rc5. Everything is fine when I use
> it
> > for stand alone program. But when I try to use it
> in a
> > web application (applciation server is resin
> 2.1.10),
> > I got following error. From the log, we can see
> that
> > there is a NullPointerException at
> >
>
org.apache.ojb.broker.metadata.RepositoryXmlHandler.getIsoLevel(Unknown
> > Source) and from the debug message we can see that
> > isolation-level: null.
> >
> 
> hmm, think something wrong with your
>  >
>
file:/D:/gsnx/builds/hourly/dist/gsnx/conf/repository.xml
> file.
> 
> Should be something like that:
> 
> 
>  isolation-level="read-uncommitted"
>  proxy-prefetching-limit="50">
> 
>  
>  &database;
> 
>  
>  &internal;
> 
>  
>  &user;
> 
> 
> regards,
> Armin
> 
> > If I manually add isolation-level attribute to
> each
> > class descriptor element in
> repository_internal.xml
> > and all included repository_user.xml's, then it
> works.
> >
> >
> > I don't think there is any document saying that we
> > need to change repository_internal.xml. I am
> wondering
> > whether anybody has ever had the same problem and
> > what's the real cause and the soultion for it.
> >
> > Thanks in advance.
> >
> > Zhe
> >
> >
>
===
> > 84938 DEBUG [tcpConnection-9003-0]
> util.RequestUtils -
> > Get module name for path
> > /core/domain/party/partySearchReport.jsp
> > 84938 DEBUG [tcpConnection-9003-0]
> util.RequestUtils -
> > Module name found: default
> > 84953 DEBUG [tcpConnection-9003-0] tiles.InsertTag
> -
> > insert page='/core/fwk/mainLayout.jsp'.
> > 88953 INFO  [tcpConnection-9003-0]
> > util.PropertyMessageResources - Initializing,
> >
> config='org.apache.struts.taglib.html.LocalStrings',
> > returnNull=true
> >
> [org.apache.ojb.broker.metadata.RepositoryPersistor]
> > INFO: OJB Descriptor Repository:
> >
>
file:/D:/gsnx/builds/hourly/dist/gsnx/conf/repository.xml
> >
>
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
> > DEBUG: startDoc
> >
>
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
> > DEBUG:  proxy-prefetching-limit: null
> >
>
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
> > DEBUG:  > descriptor-repository
> >
>
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
> > DEBUG: < documentation
> >
>
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
> > DEBUG:   > class-descriptor
> >
>
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
> > DEBUG:  isolation-level: null
> > 89719 DEBUG [tcpConnection-9003-0] tiles.InsertTag
> -
> > [ServletException in:/core/fwk/mainLayout.jsp]
> null'
> > java.lang.ExceptionInInitializerError
> > at
> >
>
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKey(Un
> known
> > Source)
> > at
> >
>
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersisten
> ceBroker(Unknown
> > Source)
> > at
> >
>
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unkn
> own
> > Source)
> > at
> >
>
com.gsnx.core.server.persistence.ojb.OjbPersistenceManager.(OjbPersist
> enceManager.java)
> > at
> >
>
com.gsnx.core.server.persistence.PersistenceManagerFactory.getPersistenceMan
> ager(PersistenceManagerFactory.java)
> > at
> >
>
com.gsnx.core.server.util.lang.TranslationUtil.cacheTranslation(TranslationU
> til.java)
> > at
> >
>
com.gsnx.core.server.util.lang.TranslationUtil.getTranslation(TranslationUti
> l.java)
> > at
> >
>
com.gsnx.core.server.util.lang.TranslationUtil.message(TranslationUtil.java)
> > at
> >
>
com.gsnx.core.server.util.lang.TranslationUtil.message(TranslationUtil.java)
> > at
> >
>
com.gsnx.core.webui.fwk.util.

deploy OJB with web application

2004-01-22 Thread ZZZ Liu
I am using OJB rc5. Everything is fine when I use it
for stand alone program. But when I try to use it in a
web application (applciation server is resin 2.1.10),
I got following error. From the log, we can see that
there is a NullPointerException at 
org.apache.ojb.broker.metadata.RepositoryXmlHandler.getIsoLevel(Unknown
Source) and from the debug message we can see that
isolation-level: null.

If I manually add isolation-level attribute to each
class descriptor element in repository_internal.xml
and all included repository_user.xml's, then it works.


I don't think there is any document saying that we
need to change repository_internal.xml. I am wondering
whether anybody has ever had the same problem and
what's the real cause and the soultion for it.

Thanks in advance.

Zhe

===
84938 DEBUG [tcpConnection-9003-0] util.RequestUtils -
Get module name for path
/core/domain/party/partySearchReport.jsp
84938 DEBUG [tcpConnection-9003-0] util.RequestUtils -
Module name found: default
84953 DEBUG [tcpConnection-9003-0] tiles.InsertTag -
insert page='/core/fwk/mainLayout.jsp'.
88953 INFO  [tcpConnection-9003-0]
util.PropertyMessageResources - Initializing,
config='org.apache.struts.taglib.html.LocalStrings',
returnNull=true
[org.apache.ojb.broker.metadata.RepositoryPersistor]
INFO: OJB Descriptor Repository:
file:/D:/gsnx/builds/hourly/dist/gsnx/conf/repository.xml
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
DEBUG: startDoc
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
DEBUG:  proxy-prefetching-limit: null
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
DEBUG:  > descriptor-repository
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
DEBUG: < documentation
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
DEBUG:   > class-descriptor
[org.apache.ojb.broker.metadata.RepositoryXmlHandler]
DEBUG:  isolation-level: null
89719 DEBUG [tcpConnection-9003-0] tiles.InsertTag -
[ServletException in:/core/fwk/mainLayout.jsp] null'
java.lang.ExceptionInInitializerError
at
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKey(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker(Unknown
Source)
at
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unknown
Source)
at
com.gsnx.core.server.persistence.ojb.OjbPersistenceManager.(OjbPersistenceManager.java)
at
com.gsnx.core.server.persistence.PersistenceManagerFactory.getPersistenceManager(PersistenceManagerFactory.java)
at
com.gsnx.core.server.util.lang.TranslationUtil.cacheTranslation(TranslationUtil.java)
at
com.gsnx.core.server.util.lang.TranslationUtil.getTranslation(TranslationUtil.java)
at
com.gsnx.core.server.util.lang.TranslationUtil.message(TranslationUtil.java)
at
com.gsnx.core.server.util.lang.TranslationUtil.message(TranslationUtil.java)
at
com.gsnx.core.webui.fwk.util.HtmlUtil.resolveLabel(HtmlUtil.java)
at
_core._fwk._mainlayout__jsp._jspService(_mainlayout__jsp.java:73)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:506)
at
com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at
com.caucho.server.http.Invocation.service(Invocation.java:315)
at
com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at
com.caucho.server.http.QRequestDispatcher.include(QRequestDispatcher.java:362)
at
com.caucho.server.http.QRequestDispatcher.include(QRequestDispatcher.java:274)
at
com.caucho.jsp.QPageContext.include(QPageContext.java:547)
at
org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
at
org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
at
org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
at
org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
at
org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
at
_core._domain._party._partysearchreport__jsp._jspService(_partysearchreport__jsp.java:82)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:506)
at
com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at
com.caucho.server.http.Invocation.service(Invocation.java:315)
at
com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)
at
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:164)
at
com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:534)
Caused by:
org.apache.ojb.broker.metadata.MetadataException: Can
not read repository 

broker.commitTransaction and broker.abortTransaction for PB query

2004-01-21 Thread ZZZ Liu
Hi,

I am using PB api. I am wondering when I use PB query,
do I need to worry about transaction. I remember I
read a article saying that there is a difference
with/without transaction, something related to cache,
but I could not find the source any more. If I still
need to deal with transaction, do I need to
commitTransaction or abortTransaction when the query
is done? What's the best practice for that?

Thanks,
Zhe


__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FW: FW: Cannot retrieve back just saved objects without committing transaction

2004-01-21 Thread ZZZ Liu
Hi, Armin

Thank you very much for the fixing. But I have one
more question. If the batch mode is turned on by
calling
broker.getConnectionManager().setBatchMode("true"), db
operations will not be applied to
db until transaction is commited. In this case, I will
still have the problem if I want to insert two records
in a batch and then retrieve them back right away
without committing the transaction. This looks
differen from JDBC. After
PreparedStatement.executeBatch, even the transaction
is not commited, I believe I can still retrieve them
back. Is there any paticular reason for the OJB batch
mode implementation?

Thanks,
Zhe


> -Original Message-
> From: Armin Waibel [mailto:[EMAIL PROTECTED]
> Sent: Sunday, January 18, 2004 8:57 AM
> To: OJB Users List
> Subject: Re: FW: Cannot retrieve back just saved
> objects without
> committing transaction
> 
> 
> Hi Zhe,
> 
> I add your test case to test suite and fix the
> problem in CVS head. It
> will be included in upcoming 1.0.
> You can easy fix it by changing one line in
> ConnectionManagerImpl - see
> below.
> 
> Thank you very much for test case and detailed
> description.
> 
> regards,
> Armin
> 
> 
> RCS file:
>
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/ConnectionManage
> rImpl.java,v
>retrieving revision 1.9
>retrieving revision 1.10
>diff -u -r1.9 -r1.10
>--- ConnectionManagerImpl.java 2 Nov 2003
> 13:21:08 -1.9
>+++ ConnectionManagerImpl.java 18 Jan 2004
> 16:47:35 -1.10
>@@ -101,7 +101,14 @@
> this.jcd =
>
MetadataManager.getInstance().connectionRepository().getDescriptor(pbKey);
> this.connectionFactory =
>
ConnectionFactoryFactory.getInstance().createConnectionFactory();
> this.platform =
> PlatformFactory.getPlatformFor(jcd);
>-setBatchMode(this.jcd.getBatchMode());
>+/*
>+by default batch mode is not enabled and
> after use of a PB
>+instance, before instance was returned
> to pool, batch mode
>+was set to false again (PB
> implementation close method)
>+Be carefully in modify this behaviour,
> changes could cause
>+unexpected behaviour
>+*/
>+setBatchMode(false);
> }
> 
> 
> 
> ZZZ Liu wrote:
> > It is a standalone program and the database is
> Oracle.
> >
> > Here is the sample code:
> >
> > Product product = new Product();
> > product.setProductCode("AAA");
> > product.setDesc("BBB");
> >
> > PersistenceBroker broker = null;
> > try
> > {
> > broker =
> >
> PersistenceBrokerFactory.defaultPersistenceBroker();
> > broker.beginTransaction();
> > // assuming "AAA" is a new record that does
> not
> > exist in database
> > broker.store(product,
> > ObjectModificationDefaultImpl.INSERT);
> >
> > Query query = new
> QueryByCriteria(Product.class,
> > null);
> > Collection all =
> > broker.getCollectionByQuery(query);
> > Iterator iter = all.iterator();
> > while (iter.hasNext())
> > {
> > // "AAA" will not be printed
> > System.out.println(iter.next());
> > }
> > broker.commitTransaction();
> > }
> > catch (Throwable t)
> > {
> >  broker.abortTransaction();
> >  t.printStackTrace();
> > }
> > finally
> > {
> >     try
> > {
> > broker.close();
> > }
> > catch (Exception e)
> > {
> > }
> > }
> > // "AAA" will be in database after the program
> > finishes.
> >
> > Thanks,
> > Zhe
> >
> > -Original Message-
> > From: Armin Waibel [mailto:[EMAIL PROTECTED]
> > Sent: Friday, January 16, 2004 12:53 AM
> > To: OJB Users List
> > Subject: Re: FW: Cannot retrieve back just saved
> > objects without
> > committing transaction
> >
> >
> > Hi Zhe,
> >
> > ZZZ Liu wrote:
> >
> >
> >>Hi, Armin
> >>
> >>Thanks a lot for your reply. I am using PB-api and
> >
> > the
> >
> >>batch mode is turned on (in
> repository_database.xml,
> >>batch-mode="true" for jdbc-connection-descriptor).
> I
> >>found that database operations are not applied to
> db
> >>until transaction is commited. For example, if I
> try
> >>to insert null into a "not null" field, I won't
> get
> &

RE: FW: Cannot retrieve back just saved objects without committing transaction

2004-01-17 Thread ZZZ Liu
It is a standalone program and the database is Oracle.

Here is the sample code:

Product product = new Product();
product.setProductCode("AAA");
product.setDesc("BBB");
 
PersistenceBroker broker = null;
try
{
broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
broker.beginTransaction();
// assuming "AAA" is a new record that does not
exist in database
broker.store(product,
ObjectModificationDefaultImpl.INSERT);

Query query = new QueryByCriteria(Product.class,
null);
Collection all =
broker.getCollectionByQuery(query);
Iterator iter = all.iterator();
while (iter.hasNext())
{
// "AAA" will not be printed
System.out.println(iter.next());
}
broker.commitTransaction();
}
catch (Throwable t)
{
 broker.abortTransaction();
 t.printStackTrace();
}
finally
{
try
{
broker.close();
}
catch (Exception e)
{
}
}
// "AAA" will be in database after the program
finishes.

Thanks,
Zhe

-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 12:53 AM
To: OJB Users List
Subject: Re: FW: Cannot retrieve back just saved
objects without
committing transaction


Hi Zhe,

ZZZ Liu wrote:

> Hi, Armin
> 
> Thanks a lot for your reply. I am using PB-api and
the
> batch mode is turned on (in repository_database.xml,
> batch-mode="true" for jdbc-connection-descriptor). I
> found that database operations are not applied to db
> until transaction is commited. For example, if I try
> to insert null into a "not null" field, I won't get
> exception until transaction is commited. Is the
> problem caused due to batch-mode=true?
> 

hmm, set batch-mode 'true' enables OJB to use batch
operations if your 
DB supports it. But you have to call 
broker.getConnectionManager().setBatchMode("true")
before begin with 
pb-tx to start a batchable session. If you do so, then
the answer is yes.

I assume your problem is another. Are you sure that
you always use the 
same PB instance?
What's the environment - servlet, stand-alone,
managed-environment?
Can you post your sample code?

regards,
Armin

> Thanks,
> Zhe
> 
> 
>>
>>-Original Message-
>>From: Armin Waibel [mailto:[EMAIL PROTECTED]
>>Sent: Thursday, January 15, 2004 2:25 AM
>>To: OJB Users List
>>Subject: Re: Cannot retrieve back just saved objects
>>without committing
>>transaction
>>
>>
>>Hi Zhe,
>>
>>ZZZ Liu wrote:
>>
>>>Hi, all
>>>
>>>I have a problem when I try to insert an object in
>>
>>a
>>
>>>data base table and then try to retrieve all
>>
>>records
>>
>>>from that table. I use the same persistence broker
>>
>>for
>>
>>>the above two operations.
>>>I found that if I don't
>>>commit the transaction after save, the retrieved
>>>records won't include the new record just saved.
>>
>>If you are using PB-api this should work.
>>PersistenceBroker has same 
>>behaviour as a "pur Connection". If you start a
>>PB-tx a connection was 
>>associated with the PB instance. Do you enable batch
>>mode?
>>
>>The ODMG-api is different, it collects all changes
>>till commit is 
>>called. To write changes to DB while the tx is
>>running, you have to call 
>>proprietary TransactionExt#flush() method.
>>
>>regards,
>>Armin
>>
>>
>>>I am
>>>wondering whether anybody else ever had this
>>
>>problem
>>
>>>and whether this is a bug or is designed in this
>>
>>way.
>>
>>>But I know if I use JDBC directly, and if I insert
>>
>>a
>>
>>>record in a database table, even though it is not
>>>commited, the record should be visible to current
>>>session (connection).
>>>
>>>I am using rc5. Any help or comments on this
>>
>>problem
>>
>>>would be much appreciated.
>>>
>>>Thanks in advance.
>>>Zhe
>>>
>>>__
>>>Do you Yahoo!?
>>>Yahoo! Hotjobs: Enter the "Signing Bonus"
>>
>>Sweepstakes
>>
>>>http://hotjobs.sweepstakes.yahoo.com/signingbonus
>>>
>>>
>>
>
-
> 
>>>To unsubscribe, e-mail:
>>
>>[EMAIL PROTECTED]
>>
>>>For additional commands, e-mail:
>>
>>[EMAIL PROTECTED]
>>
>>>
>>>
>>

Re: FW: Cannot retrieve back just saved objects without committing transaction

2004-01-16 Thread ZZZ Liu
Hi, Armin

Thanks a lot for your reply. I am using PB-api and the
batch mode is turned on (in repository_database.xml,
batch-mode="true" for jdbc-connection-descriptor). I
found that database operations are not applied to db
until transaction is commited. For example, if I try
to insert null into a "not null" field, I won't get
exception until transaction is commited. Is the
problem caused due to batch-mode=true?

Thanks,
Zhe

> 
> 
> -Original Message-
> From: Armin Waibel [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 15, 2004 2:25 AM
> To: OJB Users List
> Subject: Re: Cannot retrieve back just saved objects
> without committing
> transaction
> 
> 
> Hi Zhe,
> 
> ZZZ Liu wrote:
> > Hi, all
> > 
> > I have a problem when I try to insert an object in
> a
> > data base table and then try to retrieve all
> records
> > from that table. I use the same persistence broker
> for
> > the above two operations.
> > I found that if I don't
> > commit the transaction after save, the retrieved
> > records won't include the new record just saved.
> 
> If you are using PB-api this should work.
> PersistenceBroker has same 
> behaviour as a "pur Connection". If you start a
> PB-tx a connection was 
> associated with the PB instance. Do you enable batch
> mode?
> 
> The ODMG-api is different, it collects all changes
> till commit is 
> called. To write changes to DB while the tx is
> running, you have to call 
> proprietary TransactionExt#flush() method.
> 
> regards,
> Armin
> 
> > I am
> > wondering whether anybody else ever had this
> problem
> > and whether this is a bug or is designed in this
> way.
> > But I know if I use JDBC directly, and if I insert
> a
> > record in a database table, even though it is not
> > commited, the record should be visible to current
> > session (connection).
> > 
> > I am using rc5. Any help or comments on this
> problem
> > would be much appreciated.
> > 
> > Thanks in advance.
> > Zhe
> > 
> > __
> > Do you Yahoo!?
> > Yahoo! Hotjobs: Enter the "Signing Bonus"
> Sweepstakes
> > http://hotjobs.sweepstakes.yahoo.com/signingbonus
> > 
> >
>
-
> > 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]
> 
> 


__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Cannot retrieve back just saved objects without committing transaction

2004-01-15 Thread ZZZ Liu
Hi, all

I have a problem when I try to insert an object in a
data base table and then try to retrieve all records
from that table. I use the same persistence broker for
the above two operations. I found that if I don't
commit the transaction after save, the retrieved
records won't include the new record just saved. I am
wondering whether anybody else ever had this problem
and whether this is a bug or is designed in this way.
But I know if I use JDBC directly, and if I insert a
record in a database table, even though it is not
commited, the record should be visible to current
session (connection).

I am using rc5. Any help or comments on this problem
would be much appreciated.

Thanks in advance.
Zhe

__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



QueryBySQL and bind variables

2003-12-13 Thread ZZZ Liu
Hi,

Could anybody tell me that whether QueryBySQL supports
bind variables and how to do that?

Thanks in advance!

Z

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]