Cache Question (M:N Relationship)

2003-08-14 Thread Aaron Longwell
OJB Gurus,

I'm having a problem getting the cache to update in an m:n relationship. 
I am using the PB API.

I have Band entities which represent a band of the musical variety. I 
also have Event entities which represent a concert/party/banquet at a 
particular location. Lastly, I have a Performance entity which 
represents the convergence of a particular Band at a particular Event. 
It's an m:n relationship between Band and Event, with Performance as the 
joining table. Here's the problem scenario:

View an Event object, which nests a collection of performances. 
Drill-down to the performance itself, then delete the performance. Prior 
to the delete, the Event object (containing a nested collection of 
performances) was cached. I delete the performance via this code (not a 
complete listing):

broker.beginTransaction();
broker.delete(performance);
broker.commitTransaction();
After this process succeeds, I check the database. The performance 
record is gone. Everything goes according to plan EXCEPT, when I 
return to the Band OR Event screens, the listing for that performance is 
still there, despite having been removed from the database.

As a workaround, I am using a clearCache() call before every query I 
know exactly how brute force this approach is, but I needed a working 
fix ASAP Now I'd like to know how to do this (delete an item from a 
joining table) correctly in OJB.

Thank you for any help,
Aaron Longwell




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


Re: Object Database?

2003-07-23 Thread Aaron Longwell
Thomas,

Excellent response. I think I'll be spending some time mastering an 
OODBMS sometime soon. I have a few additional questions of clarification.

1) I have some ambient experience with ODMG and I've read an article on 
JDO :). Any sites/tutorials/articles you can recommend on introductions 
to those technologies? I've always used the PB API with OJB to this point.

2) A small percentage of my clients have large enough sites that they 
require clustered solutions. Do most OODBMS's run in the same JVM as the 
business logic? Do any provide built in clustering support? DB 
synchronization amongst databases in a cluster?

Thanks once again for your advice,
Aaron
Thomas Mahler wrote:

Hi Aaron,

Aaron Longwell wrote:

I have only recently realized the awesome benefits of an O/R mapping 
tool. And I absolutely love OJB!

But I've been wondering if OJB is really the best solution for my 
projects. I typically have 100% control over the environment 
(small-medium sized projects with no legacy data and no RDBMS 
requirement).


If you are not required to use an RDBMS *and* you are familiar to 
object persistence APIs like ODMG and JDO, you are typically much 
better of with an OODBMS!

I once was architecting a solution for our company and did the 
prototyping with a an ODMG compliant ODBMS (Objectivity). I finished a 
persistent DOM implementation for parsed XML documents within 1 day!

Unfortunately the upper management refused to use an OODBMS instead of 
our existing RDBMS for production.

So I thought: It would be great to code against the ODMG API and use 
the RDBMS as persistence backend. We urgently need an O/R mapping tool 
with an ODMG API.
The rest is history...


I'm wondering whether an actual object database might be better for 
these cases. Can those who have experience give some input on my 
questions?

1) What Open Source Object databases exist (for Java)?


A very cool solution is prevayler.sf.net. It's even cooler than an 
OODBMS (IMHO).

I'm thinking of providing a Prevayler based PersistenceBrokerImpl for 
some time now...
By doing this we could provide all the OJB APIs but without all the 
RDBMS related hassle.

There is also the classic OZONE (also provide an ODMG API)
You can search the sourceforge project list for dozens of other 
implementations

2)  How does performance compare to OJB? (I utilize the object cache 
extensively)


prevayler is incredibly fast, as everything is kept in memory and 
there is no need to perform SQL queries. Everything can be reached by 
normal Java references.

3) How is development time affected? I'm guessing that systems 
designed around object databases take a little more front-end planning.


My experience with Objectivity and POET is that development time is 
drastically improved, as you have to think much less about 
data-management issues.
On the other hand you may have some more trouble in the long term 
because of schema evolution, that is changes to your persistent 
classes. YOu have to make sure that instances stored before changing 
the class layout can still be used after applying the changes to the 
class!
This may be really tricky!

cheers,
Thomas
Thanks for your input,
Aaron
-
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]





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


Object Database?

2003-07-22 Thread Aaron Longwell
I have only recently realized the awesome benefits of an O/R mapping 
tool. And I absolutely love OJB!

But I've been wondering if OJB is really the best solution for my 
projects. I typically have 100% control over the environment 
(small-medium sized projects with no legacy data and no RDBMS 
requirement). I'm wondering whether an actual object database might be 
better for these cases. Can those who have experience give some input on 
my questions?

1) What Open Source Object databases exist (for Java)?
2)  How does performance compare to OJB? (I utilize the object cache 
extensively)
3) How is development time affected? I'm guessing that systems designed 
around object databases take a little more front-end planning.

Thanks for your input,
Aaron
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Urgent: Example for Report Query

2003-07-21 Thread Aaron Longwell
I cannot figure out how to do a report query. Here's my set up:

Class: Band
   Fields: Name, ContactPerson, ContactPhone
   Collection: Performances
Class: Performance
   Fields: Payout, Attendance
I need to do a report query that will give me 5 columns: Band.Name, 
Band.ContactPerson, Band.ContactPhone, Avg(Performance.Payout), 
Avg(Performance.Attendance).

I then need to order by Name, Attendance or Payout based on the user's 
selection.

In real SQL it would look something like this:

SELECT Band.Name, AVG(Performance.Payout) As Payout,  
AVG(Performance.Attendance) As Attendace, Band.ContactPerson, 
Band.ContactPhone

FROM Band

INNER JOIN Performance ON Performance.BandID = Band.ID

GROUP BY Band.Name, Band.ContactPerson, Band.ContactPhone
ORDER BY Attendance ASC
I have been thoroughly impressed with the quality of the OJB product, 
but I have had the hardest time learning how to use it using only the 
online documentation. I am willing to help out with documentation 
writing of examples to answer questions like mine above.

Thank you for your time,
Aaron Longwell


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


Re: Urgent: Example for Report Query

2003-07-21 Thread Aaron Longwell
Ron,

Thanks for the prompt response... your code looks great... except for a 
few items. criteria.addGroupBy() and addOrderBy*() have been 
deprecated... I think the same methods on the query object are preferred 
now. That's sort of irrelevant though.

I am getting the error: Error reading from result set: Column 'Genre' 
not found. Genre is another property on the Band object and a column in 
my SQL database. It is irrelevant to this report, but OJB seems to be 
hung up trying to populate a Band object with a Genre field that doesn't 
exist in the query.

1) Why is OJB creating a Band object this is a report query... isn't 
it supposed to return raw data and ignore my Business objects?

2) When this report query finally works, how do I access that data? Is 
it a collection of hashmaps keyed by the column name?

Once again, thank you for your prompt and helpfuil response.

Thanks,
Aaron
Ron Gallagher wrote:

Aaron --

This should create the query you need.

   String fields[] = new String[]{
   /* 0 */ Name,
   /* 1 */ avg(Performances.Payout),
   /* 2 */ avg(Performances.Attendance),
   /* 3 */ ContactPerson,
   /* 4 */ ContactPhone};
   // Assemble the criteria.
   Criteria criteria = new Criteria();
   criteria.addGroupBy(fields[0]);
   criteria.addGroupBy(fields[3]);
   criteria.addGroupBy(fields[4]);
   criteria.addOrderByAscending(avg(Performances.Attendance));
   // Assemble the query.
   ReportQueryByCriteria query =
   new ReportQueryByCriteria(
   Band.class,
   fields,
   criteria);
Then, just use the getCollectionByQuery method on the PB to get the results.

HTH

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]
 

From: Aaron Longwell [EMAIL PROTECTED]
Date: 2003/07/21 Mon AM 11:53:46 EDT
To: OJB User [EMAIL PROTECTED]
Subject: Urgent: Example for Report Query
I cannot figure out how to do a report query. Here's my set up:

Class: Band
   Fields: Name, ContactPerson, ContactPhone
   Collection: Performances
Class: Performance
   Fields: Payout, Attendance
I need to do a report query that will give me 5 columns: Band.Name, 
Band.ContactPerson, Band.ContactPhone, Avg(Performance.Payout), 
Avg(Performance.Attendance).

I then need to order by Name, Attendance or Payout based on the user's 
selection.

In real SQL it would look something like this:

SELECT Band.Name, AVG(Performance.Payout) As Payout,  
AVG(Performance.Attendance) As Attendace, Band.ContactPerson, 
Band.ContactPhone

FROM Band

INNER JOIN Performance ON Performance.BandID = Band.ID

GROUP BY Band.Name, Band.ContactPerson, Band.ContactPhone
ORDER BY Attendance ASC
I have been thoroughly impressed with the quality of the OJB product, 
but I have had the hardest time learning how to use it using only the 
online documentation. I am willing to help out with documentation 
writing of examples to answer questions like mine above.

Thank you for your time,
Aaron Longwell


-
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]


 



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


Re: Urgent: Example for Report Query

2003-07-21 Thread Aaron Longwell
Ron,

Using your logic, I'm trying another (less efficient I know) method of 
accomplishing my task. Here's my code:

   Criteria criteria = new Criteria();
   criteria.addOrderBy(performances.payout, true);
   Query query = QueryFactory.newQuery(Band.class, criteria, true);
This code returns Band objects (on which I have an inefficient method to 
find average data for the Performance Collections). My code is working 
correctly, except OJB is giving me duplicate records. I currently have 5 
records in that table, and the first two alphabetically are getting 
repeated when I try to order by performances.Payout. This is unusual.

Thanks,
Aaron
Ron Gallagher wrote:

Aaron --

This should create the query you need.

   String fields[] = new String[]{
   /* 0 */ Name,
   /* 1 */ avg(Performances.Payout),
   /* 2 */ avg(Performances.Attendance),
   /* 3 */ ContactPerson,
   /* 4 */ ContactPhone};
   // Assemble the criteria.
   Criteria criteria = new Criteria();
   criteria.addGroupBy(fields[0]);
   criteria.addGroupBy(fields[3]);
   criteria.addGroupBy(fields[4]);
   criteria.addOrderByAscending(avg(Performances.Attendance));
   // Assemble the query.
   ReportQueryByCriteria query =
   new ReportQueryByCriteria(
   Band.class,
   fields,
   criteria);
Then, just use the getCollectionByQuery method on the PB to get the results.

HTH

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]
 

From: Aaron Longwell [EMAIL PROTECTED]
Date: 2003/07/21 Mon AM 11:53:46 EDT
To: OJB User [EMAIL PROTECTED]
Subject: Urgent: Example for Report Query
I cannot figure out how to do a report query. Here's my set up:

Class: Band
   Fields: Name, ContactPerson, ContactPhone
   Collection: Performances
Class: Performance
   Fields: Payout, Attendance
I need to do a report query that will give me 5 columns: Band.Name, 
Band.ContactPerson, Band.ContactPhone, Avg(Performance.Payout), 
Avg(Performance.Attendance).

I then need to order by Name, Attendance or Payout based on the user's 
selection.

In real SQL it would look something like this:

SELECT Band.Name, AVG(Performance.Payout) As Payout,  
AVG(Performance.Attendance) As Attendace, Band.ContactPerson, 
Band.ContactPhone

FROM Band

INNER JOIN Performance ON Performance.BandID = Band.ID

GROUP BY Band.Name, Band.ContactPerson, Band.ContactPhone
ORDER BY Attendance ASC
I have been thoroughly impressed with the quality of the OJB product, 
but I have had the hardest time learning how to use it using only the 
online documentation. I am willing to help out with documentation 
writing of examples to answer questions like mine above.

Thank you for your time,
Aaron Longwell


-
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]


 



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


Cascading Delete

2003-07-15 Thread Aaron Longwell
I've looked through the docs for this, but they are, forgive me, rather 
unclear.

I have an m:n relationship of Bands and Performances.

I want a cascading delete to occur so that whenever the Band is deleted, 
it's corresponding performances are also deleted.

However, when a performance is deleted, I do not want the corresponding 
Band to be deleted because that Band may have other performances.

My Band class-descriptor has a collection descriptor called 
performances do I put the auto-delete here? Do I need to put an 
auto-delete anywhere on the performance? I am unclear as to whether the 
auto-delete attribute says, delete the class-descriptor which contains 
this attribute when this reference is deleted or if it says, delete 
this reference if the class-descriptor containing it is deleted.

Thanks for the help,
Aaron
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Performance Test Results

2003-07-11 Thread Aaron Longwell
Thanks Thomas,

I've stopped running out of connection pools... I'm above the threshold now.

What is the reason for having both a properties and XML configuration 
file? I think it would be more convenient to have a globals section in 
the repository.xml. Just my opinion.

Thanks again,
Aaron
Thomas Mahler wrote:

Hi Aaron,

OJB uses several Pools. One pool is used for Broker instances.
Then there is another pool for JDBC connections.
What you see is a shortage of JDBC connections.
The Broker pool is configured in OJB.properties, as it is a global 
setting.
The Connection Pool is configured in repository.xml, as it can be 
configured per JDBC connection.

connection-pool
maxActive=100
whenExhaustedAction=2
/
Allows 100 parallel connnections. If all connections are exhausted the 
pool grows (=2).

all features are documented here:
http://db.apache.org/ojb/repository.html#connection-pool
cheers,
Thomas
Aaron Longwell wrote:

I have decided to load test an OJB+Struts web application I am 
building. The results, pass! (but not by a whole lot).

My goal was to support 100 simultaneous users. The application is an 
event scheduler, for which one view is a calendar-formatted display 
of events for the month. It uses OJBs getCollectionByQuery (PB API) 
to retrieve the events.

Using Apache's JMeter, I simulated 100 users loading the calendar  
page about every 15 seconds. This comes out to around 6-8 requests 
per second. Average response times are under 1 second on my very 
modest machine. I received no errors after running at this load for 
several minutes... in short.. a successful test.

However, upping the users to 150 begins destroying the error 
percentage. Every error that occured was a commons-logging unable to 
borrow connection from pool exception (see afterword for 
StackTrace). Can someone explain the performance enhancement features 
of OJB to me?

I have perused the OJB.properties and found maxActive=100 as the 
default for the number of brokers. I have changed this to 600 with no 
result. In my stack trace I see that there is a 
connectionPoolDescriptor setting of maxActive=21 (see below). Is it 
possible to change this value in the properties file? What is the 
name for the name value pair if so? Are there other enhancements I 
can make to support more users?

Thanks,
Aaron Longwell
Selected Portions of Stack Trace:

Used ConnectionManager instance could not obtain a connection: Could 
not borrow connection from pool - 
org.apache.ojb.broker.metadata.JdbcConnectionDescriptor:  
[EMAIL PROTECTED]
 jcd-alias=dovedb
 default-connection=true
 dbms=MySQL
 jdbc-level=2.0
 driver=com.mysql.jdbc.Driver
 protocol=jdbc
 sub-protocol=mysql
 db-alias=//localhost/dove
 eager-release=false
 ConnectionPoolDescriptor={whenExhaustedAction=0, maxIdle=-1, 
maxActive=21, maxWait=5000, removeAbandoned=false, 
numTestsPerEvictionRun=10, testWhileIdle=false, 
minEvictableIdleTimeMillis=60, testOnReturn=false, 
logAbandoned=false, removeAbandonedTimeout=300, 
timeBetweenEvictionRunsMillis=-1, testOnBorrow=true}

-
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]





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


Re: Performance Test Results

2003-07-11 Thread Aaron Longwell
Jason,

I am running in Tomcat by itself. I haven't hit any broker instance 
errors, just connection pool ones but this is solved after changing 
the maxActive setting.

Aaron

Jason McKerr wrote:

You broker instances would still be limited by your connection pool I
think.  Are you in a standalone or application server environment?
Jason

On Thu, 2003-07-10 at 22:27, Aaron Longwell wrote:
 

I have decided to load test an OJB+Struts web application I am building. 
The results, pass! (but not by a whole lot).

My goal was to support 100 simultaneous users. The application is an 
event scheduler, for which one view is a calendar-formatted display of 
events for the month. It uses OJBs getCollectionByQuery (PB API) to 
retrieve the events.

Using Apache's JMeter, I simulated 100 users loading the calendar  page 
about every 15 seconds. This comes out to around 6-8 requests per 
second. Average response times are under 1 second on my very modest 
machine. I received no errors after running at this load for several 
minutes... in short.. a successful test.

However, upping the users to 150 begins destroying the error percentage. 
Every error that occured was a commons-logging unable to borrow 
connection from pool exception (see afterword for StackTrace). Can 
someone explain the performance enhancement features of OJB to me?

I have perused the OJB.properties and found maxActive=100 as the default 
for the number of brokers. I have changed this to 600 with no result. In 
my stack trace I see that there is a connectionPoolDescriptor setting of 
maxActive=21 (see below). Is it possible to change this value in the 
properties file? What is the name for the name value pair if so? Are 
there other enhancements I can make to support more users?

Thanks,
Aaron Longwell
Selected Portions of Stack Trace:

Used ConnectionManager instance could not obtain a connection: Could not 
borrow connection from pool - 
org.apache.ojb.broker.metadata.JdbcConnectionDescriptor:  
[EMAIL PROTECTED]
 jcd-alias=dovedb
 default-connection=true
 dbms=MySQL
 jdbc-level=2.0
 driver=com.mysql.jdbc.Driver
 protocol=jdbc
 sub-protocol=mysql
 db-alias=//localhost/dove
 eager-release=false
 ConnectionPoolDescriptor={whenExhaustedAction=0, maxIdle=-1, 
maxActive=21, maxWait=5000, removeAbandoned=false, 
numTestsPerEvictionRun=10, testWhileIdle=false, 
minEvictableIdleTimeMillis=60, testOnReturn=false, 
logAbandoned=false, removeAbandonedTimeout=300, 
timeBetweenEvictionRunsMillis=-1, testOnBorrow=true}

-
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]


 



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


Re: addLessThan or addBetween with Dates in mySQL

2003-06-16 Thread Aaron Longwell
Edison,

I'm actually using the same conversion... were you using mySQL?

Thanks,
Aaron
Edson Carlos Ericksson Richter wrote:

Hi!

I've used Dates normally with less than, greater than and between with
SapDB.
Unique thing I had todo is put a conversion in field like:
conversion=org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimest
ampFieldConversion
then it works for me.

Edson Richter

- Original Message - 
From: Aaron Longwell [EMAIL PROTECTED]
To: OJB User [EMAIL PROTECTED]
Sent: Monday, June 16, 2003 2:42 AM
Subject: addLessThan or addBetween with Dates in mySQL

OJB Experts,

I am using mySQL with OJB to build an event calendar. I need to display
1 month's worth of events. At first, I tried code like this:
criteria.addBetween(EventDate, startDate, endDate);

where startDate and endDate are java.util.Dates. I got no results, even
though there are events in the database between those two dates. I
retried with a single addGreaterOrEqualThan(). This worked as expected,
returning events whose date was on or after the startDate submitted. I
then tried the addLessOrEqualThan(). This returned 0 results, even
though there are events before the submitted date in the database.
The Javadocs show examples of these commands being used with integers
and not dates. Am I wrong to even attempt this? I would prefer not to
implement my method an addSQL() call. I would think Date-handling would
be automatic with an OJB tool.
Thanks for the help,
Aaron




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


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


-
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]


Re: addLessThan or addBetween with Dates in mySQL

2003-06-16 Thread Aaron Longwell
Jakob,

How do I retrieve the raw SQL for a Query object (or criteria)?

The SQL I am using now (working correctly):

SimpleDateFormat fmt = (SimpleDateFormat) DateFormat.getDateTimeInstance();
fmt.applyPattern(-MM-dd HH:mm:ss);
criteria.addSql(StartDate = ' + fmt.format(startDate) + ' AND 
StartDate  ' +
   fmt.format(endDate) + ');
Query query = QueryFactory.newQuery(Event.class, criteria);

Notice that I'm using the addSql() method... I cannot get the 
addLessThan to work with identical date values.

Thanks,
Aaron
Jakob Braeuchi wrote:

hi aaron,

afaik ojb does nothing special when using dates with mysql, it maybe 
the driver.
could you please post the sql that caused the problem, so i can check 
it with my mySQL db.

hth
jakob
Aaron Longwell wrote:

Edson,

I think there's something wrong with the way OJB is turning an 
addLessThan to SQL code on the mySQL implementation. I switched my 
code to SimpleDateFormat the submitted dates and turn them into 
mySQL-DateTime format (2003-05-18 00:00:00). I then use 
addSQL(StartDate = ' + strStartDate + ' AND StartDate  ' + 
strEndDate + ');

This works just fine... I guess I can deal with it for now.



Edson Carlos Ericksson Richter wrote:

Nop. I'm using SapDB and MS SQL.
Maybe you are having some kind of driver issue here.
Edson Richter

- Original Message - From: Aaron Longwell 
[EMAIL PROTECTED]
To: OJB Users List [EMAIL PROTECTED]
Sent: Monday, June 16, 2003 10:40 AM
Subject: Re: addLessThan or addBetween with Dates in mySQL

Edison,

I'm actually using the same conversion... were you using mySQL?

Thanks,
Aaron
Edson Carlos Ericksson Richter wrote:

 

Hi!

I've used Dates normally with less than, greater than and between with
SapDB.
Unique thing I had todo is put a conversion in field like:
conversion=org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimes
  


t
 

ampFieldConversion

then it works for me.

Edson Richter

- Original Message - From: Aaron Longwell 
[EMAIL PROTECTED]
To: OJB User [EMAIL PROTECTED]
Sent: Monday, June 16, 2003 2:42 AM
Subject: addLessThan or addBetween with Dates in mySQL

OJB Experts,

I am using mySQL with OJB to build an event calendar. I need to 
display
1 month's worth of events. At first, I tried code like this:

criteria.addBetween(EventDate, startDate, endDate);

where startDate and endDate are java.util.Dates. I got no results, 
even
though there are events in the database between those two dates. I
retried with a single addGreaterOrEqualThan(). This worked as 
expected,
returning events whose date was on or after the startDate submitted. I
then tried the addLessOrEqualThan(). This returned 0 results, even
though there are events before the submitted date in the database.

The Javadocs show examples of these commands being used with integers
and not dates. Am I wrong to even attempt this? I would prefer not to
implement my method an addSQL() call. I would think Date-handling 
would
be automatic with an OJB tool.

Thanks for the help,
Aaron




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


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


-
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]


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.489 / Virus Database: 288 - Release Date: 10/6/2003
-
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]





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


Re: addLessThan or addBetween with Dates in mySQL

2003-06-16 Thread Aaron Longwell
I'm not familiar with p6spy.. is that a class within OJB? Or a 
log4j-type logger?

Jakob Braeuchi wrote:

hi aaron,

you can use p6spy to log all the sql.
btw it works with my installation:
   QueryByCriteria query;
   Criteria crit;
   Date d1, d2;
 d1 = new Date(70,0,1);
   d2 = new Date(77,0,1);
 crit = new Criteria();
   crit.addBetween(geburtsDatum, d1, d2);
   query = new QueryByCriteria(Person.class, crit);
   query.addOrderByAscending(geburtsDatum);
   broker.getCollectionByQuery(query);
...
  field-descriptor
name=geburtsDatum
column=gebDat
jdbc-type=DATE

conversion=org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion 

 /
...
p6spy output:
SELECT 
A0.isBoss,A0.gebDat,A0.idTest,A0.entryDate,A0.adresse,A0.idPartner,A0.name,A0.test,A0.vorname,A0.id 
FROM tabPerson A0 WHERE A0.gebDat BETWEEN  ? AND ?  ORDER BY 2

p6spy output with filed variables:
SELECT 
A0.isBoss,A0.gebDat,A0.idTest,A0.entryDate,A0.adresse,A0.idPartner,A0.name,A0.test,A0.vorname,A0.id 
FROM tabPerson A0 WHERE A0.gebDat BETWEEN  '1970-01-01' AND 
'1977-01-01'  ORDER BY 2

hth
jakob
Aaron Longwell wrote:

Jakob,

How do I retrieve the raw SQL for a Query object (or criteria)?

The SQL I am using now (working correctly):

SimpleDateFormat fmt = (SimpleDateFormat) 
DateFormat.getDateTimeInstance();
fmt.applyPattern(-MM-dd HH:mm:ss);

criteria.addSql(StartDate = ' + fmt.format(startDate) + ' AND 
StartDate  ' +
   fmt.format(endDate) + ');
Query query = QueryFactory.newQuery(Event.class, criteria);

Notice that I'm using the addSql() method... I cannot get the 
addLessThan to work with identical date values.

Thanks,
Aaron
Jakob Braeuchi wrote:

hi aaron,

afaik ojb does nothing special when using dates with mysql, it maybe 
the driver.
could you please post the sql that caused the problem, so i can 
check it with my mySQL db.

hth
jakob
Aaron Longwell wrote:

Edson,

I think there's something wrong with the way OJB is turning an 
addLessThan to SQL code on the mySQL implementation. I switched my 
code to SimpleDateFormat the submitted dates and turn them into 
mySQL-DateTime format (2003-05-18 00:00:00). I then use 
addSQL(StartDate = ' + strStartDate + ' AND StartDate  ' + 
strEndDate + ');

This works just fine... I guess I can deal with it for now.



Edson Carlos Ericksson Richter wrote:

Nop. I'm using SapDB and MS SQL.
Maybe you are having some kind of driver issue here.
Edson Richter

- Original Message - From: Aaron Longwell 
[EMAIL PROTECTED]
To: OJB Users List [EMAIL PROTECTED]
Sent: Monday, June 16, 2003 10:40 AM
Subject: Re: addLessThan or addBetween with Dates in mySQL

Edison,

I'm actually using the same conversion... were you using mySQL?

Thanks,
Aaron
Edson Carlos Ericksson Richter wrote:

 

Hi!

I've used Dates normally with less than, greater than and between 
with
SapDB.
Unique thing I had todo is put a conversion in field like:

conversion=org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimes
  




t
 

ampFieldConversion

then it works for me.

Edson Richter

- Original Message - From: Aaron Longwell 
[EMAIL PROTECTED]
To: OJB User [EMAIL PROTECTED]
Sent: Monday, June 16, 2003 2:42 AM
Subject: addLessThan or addBetween with Dates in mySQL

OJB Experts,

I am using mySQL with OJB to build an event calendar. I need to 
display
1 month's worth of events. At first, I tried code like this:

criteria.addBetween(EventDate, startDate, endDate);

where startDate and endDate are java.util.Dates. I got no 
results, even
though there are events in the database between those two dates. I
retried with a single addGreaterOrEqualThan(). This worked as 
expected,
returning events whose date was on or after the startDate 
submitted. I
then tried the addLessOrEqualThan(). This returned 0 results, even
though there are events before the submitted date in the database.

The Javadocs show examples of these commands being used with 
integers
and not dates. Am I wrong to even attempt this? I would prefer 
not to
implement my method an addSQL() call. I would think Date-handling 
would
be automatic with an OJB tool.

Thanks for the help,
Aaron




- 

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


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


- 

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]


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus

Re: Experience in High-Load Environments

2003-06-13 Thread Aaron Longwell
Thanks for your advice Mauricio

Mauricio CASTRO wrote:

Hi Aaron.

I don't have any real life example with OJB. I worked in the design and
developing of a server written in Java that handled a very heavy load and
has a complex data model, it was mounted in a Solaris/sparc machine with
Informix. We used object locks, caches and many features that OJB include
but homemade. We didn't knew that OJB existed and I doubt OJB in that time
was ready for production. The key for success in performance was to improve
the design. The cache and precalculated results were very important for
performance.
On the other hand I am writing a similar software that will use OJB. I have
done preliminary tests and I can say that the basics features of OJB behave
well for large loads of work. The jdbc driver and the RDBMS have a very
important role in performance and stability, and are often underestimated.
But the design of the application is paramount for performance and
stability. In synthesis I think that OJB can do if you don't try the complex
or untested features. I think that in the future, OJB will be very stable an
apt for that kind of applications.
Mauricio Castro.

- Original Message - 
From: Aaron Longwell [EMAIL PROTECTED]
To: OJB Users List [EMAIL PROTECTED]
Sent: Friday, June 13, 2003 12:20 AM
Subject: Re: Experience in High-Load Environments

 

Do you have any examples of projects you've seen/worked on?

i.e.: Using Oracle, widgets.com easily handles 500,000 requests an hour

I'm actually not that concerned about using OJB for my current
project the load isn't that large. But I would like to know the
limits of the technology.
Mauricio CASTRO wrote:

   

It will depends largely on which RDBMS you use, and which OJB features
 

you
 

use. I think all the basics features of OJB can do the trick.

Mauricio Castro.

- Original Message - 
From: Aaron Longwell [EMAIL PROTECTED]
To: OJB User [EMAIL PROTECTED]
Sent: Friday, June 13, 2003 12:14 AM
Subject: Experience in High-Load Environments



 

I realize I may be comparing Apples to Enterprise Applications here, but
I'd like to hear some feedback about using OJB in high-load (load
balanced?) environments.
On an OJB web application, how many requests have you seen an
application handle? Would anyone be concerned about using OJB on an
enormous e-commerce site? (EBay, Amazon, etc)?
Thanks for the input,
Aaron
-
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]


.



 

   

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


 




Re: Experience in High-Load Environments

2003-06-13 Thread Aaron Longwell
Thomas,

Thanks for the info. You've answered my questions. I was just curious to 
hear some info on the impact of OJB's O/R mapping on 
speed/performance/capacity. I've heard from several people that OJB is 
efficient enough to use in very high-load situations... and you're very 
helpful to point out that the performance limits of OJB (however 
minimal) can be overcome by adding machines to the business tier.

Thanks again,
Aaron
Thomas Mahler wrote:

Hi again Aaron,

I'm not exactly sure what you expect from the figures that other 
people provide?
Maybe I tell you we once stresstested a Struts/OJB based system with 
200 concurrent users firing requests and a sub-second average response 
time.
It was a Tandem Nonstop system with 2 300 Mhz CPU, each equipped with 
512MB of Ram. We used the Tandem Nonstop SQL database.
This test was helpful for our project, because we got clear figures 
about our then target environment.

But how can such figures be of any help for you? I don't expect that 
you are running on an environment as exotic as Tandem Nonstop Server :-)

By running a Struts/OJB based applications on clustered J2EE Server 
you will be able to achieve *any* request per minute rate that you 
want to see. Just add more machines into the cluster.

This is possible because J2EE container provide the infrastructure for 
scalibility and frameworks like STruts and OJB are carefully designed 
for scalability and not to produce any bottlenecks.

So IMO the real question is: how much throughput do you need? And how 
must your system be sized to give you this throughput.
This depends on *many* factors, and OJB is only one of them.
So IMO you have to perform such a test on your own!

DId you execute our perfoemance testsuite against your target system 
already? This tool will give you a first impression how OJB APIs 
compare to native JDBC programming.

Aaron Longwell wrote:

Jason,

Thanks for the feedback. I understand you're probably killing these 
servers doing this intense processing... but what about # users? Is 
it one guy running intense simulations... I'm curious about # 
requests per minute type of loads.

Thanks,
Aaron
Jason McKerr wrote:

I've also worked with OJB on high-load situations in J2EE 
environments. We're using JRun and/or Orion with OJB in a 
clustered/distributed
environment. This is a National Science Foundation project called the
Network for Earthquake Engineering Simulation (NEES). The only major 
problem that we ran into was the cache.  JCS just isn't
good, and hasn't seemed to get much better over the last year.  We 
ended
up plugging in Tangosol's Coherence Clustered Cache into the 
system.  We
can also do write-behinds, and buffered data caching that is queued for
transaction.  That's important to us because we're dealing with very
expensive scientific data that _can't_ get lost if a db goes down. Some
of these Tsunami experiments can get pretty expensive.

Otherwise, we use mostly the PersistenceBroker, and a little of the
ODMG.  Performance seems better on PB, but less functional.  It's not
really that much of a problem anyway, because we can cheaply and 
quickly
add app-servers to the cluster.

Jason

On Thu, 2003-06-12 at 22:14, Aaron Longwell wrote:
 

I realize I may be comparing Apples to Enterprise Applications 
here, but I'd like to hear some feedback about using OJB in 
high-load (load balanced?) environments.

On an OJB web application, how many requests have you seen an 
application handle? Would anyone be concerned about using OJB on an 
enormous e-commerce site? (EBay, Amazon, etc)?

Thanks for the input,
Aaron
-
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]


 




-
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]


Re: Experience in High-Load Environments

2003-06-12 Thread Aaron Longwell
Do you have any examples of projects you've seen/worked on?

i.e.: Using Oracle, widgets.com easily handles 500,000 requests an hour

I'm actually not that concerned about using OJB for my current 
project the load isn't that large. But I would like to know the 
limits of the technology.

Mauricio CASTRO wrote:

It will depends largely on which RDBMS you use, and which OJB features you
use. I think all the basics features of OJB can do the trick.
Mauricio Castro.

- Original Message - 
From: Aaron Longwell [EMAIL PROTECTED]
To: OJB User [EMAIL PROTECTED]
Sent: Friday, June 13, 2003 12:14 AM
Subject: Experience in High-Load Environments

 

I realize I may be comparing Apples to Enterprise Applications here, but
I'd like to hear some feedback about using OJB in high-load (load
balanced?) environments.
On an OJB web application, how many requests have you seen an
application handle? Would anyone be concerned about using OJB on an
enormous e-commerce site? (EBay, Amazon, etc)?
Thanks for the input,
Aaron
-
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]


.

 




Best Practices: Dates

2003-06-10 Thread Aaron Longwell
Goal: Retrieve a collection of objects with dates between X and Y

Current Implementation:

Event.java (Business Object) contains:
java.util.Date startDate
repository.xml maps:
field-descriptor name=startDate column=StartDate 
jdbc-type=TIMESTAMP/

PB Query:
Criteria criteria = new Criteria();
criteria.addBetween(StartDate, startDate, endDate);
Query query = QueryFactory.newQuery(Event.class, criteria);
where startDate and endDate are java.util.Dates.

When this query executes, I receive no errors about converting from 
TIMESTAMP to java.util.Date... and I DO receive results.  I receive 
ONLY records where the StartDate column is -00-00 00:00:00... or 
blank in other words. Why is it matching blank records when I am 
attempting to find records between date X and date Y?

I get similar results when using the addGreaterOrEqualThan submitting 
startDate. In this case I receive ALL records (including those with 
-00-00 00:00:00).

If you'd rather ignore all the above... I'd like to see best practices 
for using java.util.Dates with OJB (I'm using mySQL DateTime columns).

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


SequenceManagerMySQLImpl

2003-06-06 Thread Aaron Longwell
I've been looking in the API for an anwer to my previous question about 
mySQL auto_increment columns. I found the SequenceManagerMySQLImpl class 
and am attempting to implement it.

Here's what I've done:

repository.xml Excerpts: 
sequence-manager 
className=org.apache.ojb.broker.util.sequence.SequenceManagerMySQLImpl/

class-descriptor class=com.nml.dove.event.EventVO table=event
   field-descriptor name=id column=ID
   jdbc-type=BIGINT primarykey=true
   autoincrement=true/
  .

/class-descriptor

In mySQL Database:

ID bigint(20) unsigned not null auto_increment,
PRIMARY KEY ('ID')

When I execute the store command, the record is inserted correctly, but 
I get an error in the afterStore() method:

[org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl]
ERROR: while set field:
object class[ com.nml.dove.event.EventVO
target field: id
target field type: class java.lang.Long
object value class: java.lang.Integer
object value: 3]
[org.apache.ojb.broker.core.PersistenceBrokerImpl]
ERROR: SQLException during SequenceManager.afterStore (for a 
com.nml.dove.event.EventVO):
Error setting field:id in object:com.nml.dove.event.EventVO
Error setting field:id in object:com.nml.dove.event.EventVO

I am submitting the EventVO object to OJB (Persistence Broker API) with 
all fields except ID populated. I am sending ID as a null value. Because 
I am using an auto_increment column in mySQL, I want to store() the 
record without an ID.

One clue to this problem is the target field type/object value class 
discrepancy above:

target field type: class java.lang.Long
object value class: java.lang.Integer
I have no idea where the Integer is coming from. My mySQL column is a 
mediumint, which should correspond to a java Long, right? I have tried 
changing the database table to a bigint with no luck.

It appears that the record goes into the database just fine, but that 
OJB is trying to update my ValueObject (EventVO) ID column with an 
Integer instead of a long.

Is this is bug? Is something wrong with my code?





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


Re: SequenceManagerMySQLImpl

2003-06-06 Thread Aaron Longwell
Armin,

Thanks for the quick reply!

Unfortunately, I'm using these mySQL DBs in other apps that aren't able 
to utilize OJB.

Have you tried the MySQLImpl before? I am thinking something is wrong 
with my setup/code/etc... I am doing something very simple, and I would 
think even an experimental Class would work for what I'm trying to do.

Is it difficult to create a sequence manager? I don't need anything 
fancy (it doesn't even need to be extents aware).

Thanks,
Aaron
Armin Waibel wrote:

Hi Aaron,

SequenceManagerMySQLImpl is experimental, that's
the reason you could not find it in docs
http://db.apache.org/ojb/sequencemanager.html
In current CVS I add an SequenceManager implementation
called SequenceManagerNativeImpl which supports
native Identity columns. It's also experimental :-(
but seems to work with MySQL.
If possible don't use native identity columns ;-)

regards,
Armin
- Original Message -
From: Aaron Longwell [EMAIL PROTECTED]
To: ObjectRelationalBridge User [EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 5:53 PM
Subject: SequenceManagerMySQLImpl
 

I've been looking in the API for an anwer to my previous question
   

about
 

mySQL auto_increment columns. I found the SequenceManagerMySQLImpl
   

class
 

and am attempting to implement it.

Here's what I've done:

repository.xml Excerpts: 
sequence-manager
   

className=org.apache.ojb.broker.util.sequence.SequenceManagerMySQLImpl
/
 

class-descriptor class=com.nml.dove.event.EventVO table=event
   field-descriptor name=id column=ID
   jdbc-type=BIGINT primarykey=true
   autoincrement=true/
  .

/class-descriptor

In mySQL Database:

ID bigint(20) unsigned not null auto_increment,
PRIMARY KEY ('ID')

When I execute the store command, the record is inserted correctly,
   

but
 

I get an error in the afterStore() method:

   

[org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl]
 

ERROR: while set field:
object class[ com.nml.dove.event.EventVO
target field: id
target field type: class java.lang.Long
object value class: java.lang.Integer
object value: 3]
[org.apache.ojb.broker.core.PersistenceBrokerImpl]
ERROR: SQLException during SequenceManager.afterStore (for a
com.nml.dove.event.EventVO):
Error setting field:id in object:com.nml.dove.event.EventVO
Error setting field:id in object:com.nml.dove.event.EventVO
I am submitting the EventVO object to OJB (Persistence Broker API)
   

with
 

all fields except ID populated. I am sending ID as a null value.
   

Because
 

I am using an auto_increment column in mySQL, I want to store() the
record without an ID.
One clue to this problem is the target field type/object value class
discrepancy above:
target field type: class java.lang.Long
object value class: java.lang.Integer
I have no idea where the Integer is coming from. My mySQL column is a
mediumint, which should correspond to a java Long, right? I have tried
changing the database table to a bigint with no luck.
It appears that the record goes into the database just fine, but that
OJB is trying to update my ValueObject (EventVO) ID column with an
Integer instead of a long.
Is this is bug? Is something wrong with my code?





-
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]


 



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


mySQL Sequences

2003-06-05 Thread Aaron Longwell
I'm working with mySQL 4+ and OJB's current release. I am wondering 
about the preferred method for autoincrement keys in mySQL. Almost all 
of my tables have an integer ID field that autoincrements in mySQL. I 
also edit the databases directly (i.e. not through OJB) through other apps.

When I use the default sequence manager, it requires an OJB_HL_SEQ 
table, and key generation gets a little sloppy when adding or deleting 
from outside OJB. Here's what I'd like to use:

1) A sequence manager that will use mySQL's built in keying. In other 
words, I'd like to set the ID field of my (new) object to null, then 
store the record, and then check to see what ID it got.

2) A sequence manager that does not need additional tables to operate. I 
sometimes deal with situations where I have only SELECT, UPDATE, DELETE 
access on the tables I'm utilizing... and I cannot create new tables for 
OJB to utilize.

The documentation seems to suggest that there is a solution to these 
issues, but I can't find examples to try out. So far though, I love the 
convenience of OJB. Great work!

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