Re: Interfaces and xdoclet

2007-06-27 Thread Thomas Dudziak

Hi Marco,

On 6/20/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


I am developing a project using OJB with the xdoclet module as
persistance layer.
In my project I need to use interfaces, but I have a problem in the
xdoclet annotation of the interfaces.
For example, if I write:

/**
 * Interface describing a resource
 *
 * @ojb.class
 *
 *
 * @ojb.field name=description
 *  jdbc-type=VARCHAR
 *  length=300
 *
 */

public interface Resource..


The field description is marked as anonymous and inherited as
anonymous by all subclasses.
Reading the OJB guide (section Using interfaces with OJB) the
interface fields are not anonymous.
Where am I wrong?


If you put the ojb.field tag into the interface Javadoc, then they'll
be anonymous. If you want non-anonymous ones, then you need to create
declarations for the getters/setters for these fields in the interface
and tag them with ojb.field accordingly, if you want OJB to be able to
use them via the interface.

Tom

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



Re: Spring Acegi and OJB

2006-08-14 Thread Thomas Dudziak

On 8/14/06, Neil Smith [EMAIL PROTECTED] wrote:


I am about to start a new Spring MVC project using Acegi for security access 
and OJB for
persistance. Acegi has a JDBC implementation for accessing the user details 
from a database.

Question: Is it advisable to write an OJB implementation of the Acegi 
UserDetails interface to take
advantage of OJB's cashing and consistancecy of database access?

Secondly, has anyone already done this?


It sure is possible and, depending on your data model, may also make a
lot of sense.
I've done this in a former project with good success. If I remember
correctly, The general idea is:

* You should have something like a UserDAO that returns User objects
as part of your normal business model. This DAO should use Spring's
OJB DAO helper class and be a Spring-managed bean.

* Create a wrapper class around your user objects that implements
Acegi's UserDetails interface.

* Create a class that implements Acegi's UserDetailsService by calling
out to your DAO (wired via Spring). See chapter 6.2 of the Acegi doc.

* In your Acegi's configuration, use the DaoAuthenticationProvider
(chapter 7 of the Acegi doc) with your UserDetailsService
implementation.

That should be about it.
In case you also have a role concept in your business model, you'll
also want to define a mapping of your roles to Acegi's role strings
and use that in your aforementioned UserDetails. Acegi also provides
additional hooks to override it's default role concept with your own.
If you want to do that, it is best to search/ask in the Acegi forums,
though.

Tom

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



Re: Setup-db and PostgreSQL 8.1 problem

2006-08-14 Thread Thomas Dudziak

On 8/12/06, Krzysztof Borkowski [EMAIL PROTECTED] wrote:


I have just started my adveture with OJB. I've read the Getting
Started and FAQ and have tried to launch the ojb_blank. It works great
with the Hsqldb but don't want to work with PostgreSQL.

The problem is the setup-db target. It seems that the target can't work
because it tries to remove tables before it try to create them. The
tables are not present in the database so the whole process is going to
nowhere. Here is a feedback from ant (the output is a mess so please find the 
'add-shutdown-sql-file' target and look at next 5 lines):


snip


Please help with that for I don't have any more ideas what should I do (of 
course I don't want to create tables by hand if such a great tools like OJB and 
Torque exist).


You might want to use DdlUtils (http://db.apache.org/ddlutils) instead
of Torque. The schema format is the same, so all you need to do is to
replace the setup-db task in the build file.
Btw, for the 1.0.5 we'll likely replace Torque with DdlUtils in OJB.

Tom

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



Re: Key in object not propulated from Foreign key listed in reference-descriptor

2006-08-14 Thread Thomas Dudziak

On 8/11/06, Wright, Jim (NIH/CIT) [C] [EMAIL PROTECTED] wrote:


Tom, I also did a little experiment to see the order in which each
object is inserted by the store method.  However the only one that
appeared to be inserted was my report object which is the parent of
scientist and IOS objects.  I was hoping I could at least try putting
the current scid value into the scid field of IOS.  However IOS inserted
but I had no relative idea when it was inserted due to the inability to
get the firing sequence of the inserts.  I don't like to work around
the whole idea of ORM but since I cannot change our database I was
hoping for a workaround.


Mhmm, references and collections are only inserted if the auto-update
property in the corresponding descriptor is set to 'object' (or 'true'
which is the older name).
If you want to see what is happening, configure P6Spy (there's a FAQ
entry for that) and check the SQL that OJB generates.

But in general, it is not such a good idea to use PK fields for FK
fields. As I said, the identity of the object will change if you
change its reference to point to another object. And ORM tools like
OJB depend on the identity. This is what defines the object: different
PKs = different objects.

Tom

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



Re: Key in object not propulated from Foreign key listed in reference-descriptor

2006-08-11 Thread Thomas Dudziak

On 8/11/06, Wright, Jim (NIH/CIT) [C] [EMAIL PROTECTED] wrote:


I have a field in a class called IOS that is not getting populated from
the foreign key definition in the scientist reference-descriptor shown
in IOS class-descriptor.


My guess is that your problem stems from the fact that you use primary
key fields for your foreign key fields which often leads to problems.
In general you should not do that - if you change the reference to
another object, then the identity of your object will change as well
which is most certainly not what you want.
Rather use seperate non-PK fields for the references. Or if the Report
and Scientist classes link back to the IOS class (bi-directional
link), then use collections instead in the IOS class.

Tom

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



Re: in-direction table problem

2006-07-27 Thread Thomas Dudziak

On 7/26/06, Christopher Cheng [EMAIL PROTECTED] wrote:


I have a problem with the indirection table mapping.

class-descriptor
class=com.example.Project
table=Project
collection-descriptor
name=members
element-class-ref=com.example.Member
orderby=memberId
auto-retrieve=true
auto-update=true
auto-delete=false
indirection-table=ProjectPerson
fk-pointing-to-this-class column=ProjectId/
fk-pointing-to-element-class column=MemberId/
/collection-descriptor
/class-descriptor

Supposing that I set the auto-update to false, when I store the project
object with broker.store(project), will the indirection table being
updated? My experiment shows that it doesn't.


Yes, that is the intended behavior.


However, if I set auto-update
to true, the broker will store all members again. In a lot of scenerios,
it is not desirable because of performance reason.


Also true.


My question how do I store the values in the in-direction table project
person when using store() without re-save all members?


Have a look at the available settings:

http://db.apache.org/ojb/docu/guides/basic-technique.html#1%3An+auto-xxx+setting

Basically, you probably want to use the link value.

Tom

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



Re: mysql pool problem (again)

2006-07-24 Thread Thomas Dudziak

On 7/24/06, Dennis Bekkering [EMAIL PROTECTED] wrote:


I checked OJB.properties and I am using ConnectionFactoryPooledImpl.class .
I kill the connections with the mysql administrator tool, simulating timed
out connections. I discovered that the validation query is not called on non
transactional requests. Is there a special reason for that? Is it maybe wise
to check always when a new broker is called by
PersistenceBrokerFactory.defaultPersistenceBroker()?


Hmm, I'm not an expert in this area, though it sounds like a bug to
me. Can you please create a issue in JIRA ?

Tom

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



Re: mysql pool problem (again)

2006-07-21 Thread Thomas Dudziak

On 7/21/06, Dennis Bekkering [EMAIL PROTECTED] wrote:


I am experiecing problems with mysql regarding connection time outs again.
This problem cannot be resolved by the pool settings provided or jdbc driver
settings such as autoReconnect (wich should not be used anyhow). Here is a
more detailed explaination about the problem (from tss). I could set
wait_timeout on mysql much longer but that is not a solution to the problem.

-
A new feature that I'd really like to see in DBCP 1.3 is a time-to-live for
Connections. In particular with MySQL, such a feature is very helpful,
because MySQL Connections can start showing strange behavior when the
underlying connection has been terminated and implicitly reconnected.

Note that such a setting should not regard whether the connection has been
active or idle: After the specified amount of time, it should be closed and
removed from the pool in any case.

A validation query doesn't help in the MySQL scenario: The driver will
automatically reconnect and successfully execute the query, but the
Connection still has a chance of remaining in an inconsistent state. This
won't happen on every reconnect, just on some.

Two connection pools that provide such a time-to-live are Resin's
(max-pool-time) and Proxool (maximum-connection-lifetime). We're using
the former now for MySQL. Unfortunately, Proxool doesn't provide a
bean-style DataSource yet... (but will do so in the upcoming 0.9 release).

-


Hmm, I'm not too sure why you need this behavior, but I think you
should definitely ask the DBCP guys over at the commons-user mailing
list.

Tom

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



Re: ERROR: Error while iterate ResultSet for query , Error setting field

2006-07-18 Thread Thomas Dudziak

On 7/18/06, ABOU LINA [EMAIL PROTECTED] wrote:


 Hi, i got this error using db-ojb-1.0.rc5.jar.
thx in advance.



[PersistentField] ERROR: while set field:
object class[ stat.module.diffusion.donnees.BenefDirect
target field: code
target field type: class java.lang.Integer
object value class: java.lang.String
object value: 123]


This is the interesting part here: the JDBC driver apparently returned
a String (123]), not a numeric type. Please check that you don't use
a (N)VARCHAR2 there. You should also make sure that you use the latest
Oracle 10 driver (even if the DB is Oracle 8 or 9).
If that doesn't help, then you should define a field conversion for
this field where you convert between the string and integers.

HTH,
Tom

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



Re: Xdoclet proxy values

2006-07-05 Thread Thomas Dudziak

On 7/5/06, Bruno CROS [EMAIL PROTECTED] wrote:


  I noticed that the proxy keyword can't accept dynamic value. dynamic
is an accepted value in repository file and seems to be different of true.
On my setup, dynamic values works fine with CGLib proxies and,
proxy=true seems to not...

  Does someone can confirm this? if it's a missed, does XDoclet module has
been updated since 1.0.4 ?

  proxy are used in reference tag , release 1.0.4.


Yep, the proxy attribute for references does not currently allow
dynamic. Could you file an issue in JIRA for this ?

Tom

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



Re: obj persis broker error / axis

2006-06-30 Thread Thomas Dudziak

On 6/30/06, Enrico Silterra [EMAIL PROTECTED] wrote:


I am implementing a soap service to access some data
maintained by another servlet within tomcat. OJB is configured into
that servlet and works fine.

I am trying to add ojb into my soap service - so this is all happening within
the axis servlet.
I have placed the OJB.properties file in the classes directory for axis,
I have placed the ojb jar in the tomcat lib directory.
within my soap handler I have this:


snip


I arrive at the defaultPersistenceBroker()
and then only get back this from my soap call -

AxisFault
  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
  faultSubcode:
  faultString: java.lang.reflect.InvocationTargetException
  faultActor:
  faultNode:
  faultDetail:
 {http://xml.apache.org/axis/}hostname:libdev

java.lang.reflect.InvocationTargetException
 at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
 at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
 at


snip


I suppose that the persistence broker is failing but I don't know how.
How can I get some traces out of it?
How can I get some insight into its operation, and what is failing?

I have also been unable to get log4.properties to take effect. I don't know
whether this
should be placed in the tomcat classes directory, or the axis/classes
directory, or both.
I have tried both.


Well, I suppose, you should ask the Axis guys about that because it
seems that you have to configure their error reporting differently in
order to give you the full stacktrace. As far as OJB is concerned, you
only need to configure commons-logging / log4j:
http://db.apache.org/ojb/docu/guides/logging.html

Tom

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



Re: oracle id in m:n tables

2006-06-19 Thread Thomas Dudziak

On 6/19/06, Dennis Bekkering [EMAIL PROTECTED] wrote:


When i add a record to a collection that is of type many 2 many the
following sql is executed

INSERT INTO m2m_196 (ruleValueListId,ruleValueId) VALUES (?,?) , the id
field is not specified in the query but the table has such a field and
therefore oracle complains about the fact that the id is not there. I know
that i could do without an id field and use a composit id but i rather move
on  without having to change all my tables. I dont believe i can let oracle
asign id's automatically like on mysql. Is there a solution to this problem?



From what I gather Oracle complains about a missing primary key in the

table m2m_196, right ? If that's the case, then there are two easy
solutions that I can think of:

* If the pair (ruleValueListId,ruleValueId) is unique in the table,
then you can generate a composite primary key with these two columns.

* Otherwise, you should define a sequence and add a new column to the
table for the primary key. Something like this:

http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/

In this case, OJB will not have anything to do with the primary key of
the m:n table.

Tom

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



Re: Bug : duplicate objects in resultset : Why add orderby columns to resultset?

2006-06-19 Thread Thomas Dudziak

On 6/19/06, Janssen, Roger [EMAIL PROTECTED] wrote:


Diving deeper into the OJB code I see that the ensureColumns method in
fact does two things:
(1) add the columns to the returnable set of columns in the resultset
(2) adds the columns to a list of columns to be used in force a join

(2) is okay for orderby's, but (1) is not. If for orderby's (1) was left
out, would that be a problem?


As far as I remember, there was a problem a couple of months ago that
for one database all orderby columns had to be selected columns as
well (though I don't remember offhand which database it was, though).

Tom

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



Re: Using proxy and requirements for java-files

2006-06-14 Thread Thomas Dudziak

On 6/14/06, Joose Vettenranta [EMAIL PROTECTED] wrote:


I want to use generic proxy for lazy loading 1:n connections.

Say I have class Foo

Do I need to have also Interface for class Foo to make proxy to work?

Say like Interface IntFoo

or does the generic proxy thingie work without that custom Interface?


For standard JDK proxies, yes, you need to have an interface to make
them work. However, recent OJB versions also support cglib proxies
which can be used for classes too, I think.
To use them, you have to change the proxy factory in OJB.properties:

ProxyFactoryClass=org.apache.ojb.broker.core.proxy.ProxyFactoryCGLIBImpl

Tom

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



Re: Tutorial problem...

2006-06-11 Thread Thomas Dudziak

On 6/11/06, Younwook Jang [EMAIL PROTECTED] wrote:


Would you please provide advice about it..? I tried to search this
mailing list, but I couldn't find the solution...

Any information or comment also highly appreciated.


This error usually happens because either the database is not
correctly configured in build.properties (URL, database type), or
you're not allowed to execute these DDL statements (might be because
it happens right at the first SQL statement). Can you try to execute
the SQL script manually
(/Users/younwook/ws/ojb/productmanager/build/database/ojbcore-schema.sql)
and see whether the errors persist ? I tried the SQL statement where
the error happened, and it worked without a problem against a MySQL
4.1.
You should also ensure that you're using the newest JDBC driver
(3.1.13 at the moment).

Tom

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



Re: Utility for Forward engineering from repository.xml

2006-05-10 Thread Thomas Dudziak

On 5/10/06, Armin Waibel [EMAIL PROTECTED] wrote:


Seems the apache server kills your attachment.


Yep, ZIP attachements (among others) are not allowed for Apache mailing lists.


You could open an issue in JIRA
http://issues.apache.org/jira/browse/OJB
and attach the source to this issue.


Please be aware that the source code needs to be Apache 2 licensed for
us to be able to include it in OJB (see OJB's source file).

Tom

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



Re: Calling a Stored Procedure through OJB

2006-05-03 Thread Thomas Dudziak

On 5/3/06, Anjishnu Bandyopadhyay [EMAIL PROTECTED] wrote:


Thanks Antonio for the pointer.

But this does not serve my purpose. (The document talks of executing an SP when a 
persistable class/ bean (corresponding to a row of data in a table of 
database) is inserted/modified/deleted).

I intend to execute the procedure independent of any such bean modifications. 
For example, I may trigger the SP if a particular condition is met in my Java 
class.

I am looking for an alternative to the implementation of CallableStatement 
Java API.


If you want to insert/update/delete a Java object (or more precisely,
its data in the database) with this stored procedure, then Antonio's
pointer is correct.
If however this has nothing to do with actual objects, but rather you
want some plain data, then you should use raw SQL queries
(http://db.apache.org/ojb/docu/guides/query.html#Query+Criteria).

Tom

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



Re: Spring Transactions

2006-03-09 Thread Thomas Dudziak
On 3/9/06, Saman Ghodsian [EMAIL PROTECTED] wrote:

 I have an implementation of my model with OJB using just PersistenceBroker.
 Now I'm looking into adding transactional support, looked into ODMG but it
 seems complex to implement since all my mapping and query is in Broker
 lingo, so I'm looking at injecting Transaction support for my process
 methods with spring, that way I shouldn't need to change config files and
 just one class that interfaces with the Broker. Now, I tried to look for
 samples outthere found this

 http://www.springframework.org/node/116

First, you should have a look at the PetStore sample in Spring, which
includes OJB support. Also of interest is this:
http://staff.osuosl.org/~mckerrj/?p=3.

 But after setting it up transactions don't seem to be happening. So my
 questions are.

 1-   Do I need to use InnoDB on Mysql ? My tables are MyIsam.

You should definitely ask this in the Spring forums. Or rather, search
the forums - MySql is a commonly used DB so there is bound to be some
questions regarding it.

 2-   Am I missing any other feature besides applicationContext setup and
 deriving my class from PersistenceBrokerDaoSupport?

See the tutorial above. In short, you'll need the
LocalDataSourceConnectionFactory that spring provides, in
OJB.properties, and you need to declare the transaction wrapping in
the applicationContext.xml around your management or DAO objects
(management objects are preferred which logically bundle DB accesses
provided by one or more DAOs).

Tom

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



Re: Derby configuration

2006-03-07 Thread Thomas Dudziak
On 3/6/06, Sean C. McCarthy [EMAIL PROTECTED] wrote:

 I'm trying to work with Derby, but I'm not sure which DB to use for the
 torque.database property.

 Looking at the torque-gen I see there is a cloudscape, is cloudscape the
 name to set? Any other special configuration needed? Is there any
 example to follow?

The current OJB 1.0 branch contains a version of a sample Derby profile:

http://svn.apache.org/viewcvs.cgi/db/ojb/branches/OJB_1_0_RELEASE/profile/derby.profile?view=markup

It is however intended to be used with DdlUtils
(http://db.apache.org/ddlutils) because the Torque version that comes
with OJB, does not support Derby out-of-the-box.
For an example of how to use DdlUtils, see its documentation and OJB's
build file:

http://svn.apache.org/viewcvs.cgi/db/ojb/branches/OJB_1_0_RELEASE/build.xml?view=markup

especially the prepare-testdb-ddlutils target.

cheers,
Tom

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



Re: OJB 1.0.4 Error: Oracle thin driver cannot insert CLOB values with length4000

2006-03-06 Thread Thomas Dudziak
On 3/7/06, Byrne, Ailish M [EMAIL PROTECTED] wrote:

 This issue was related to the fact that we are using XAPool.  Here is
 the explanation from the experts.  I've cc'd them in case you have any
 questions.  They patched our OJB 1.0.4 jar as a temporary solution.

 _

 The problem here is the unwrapStatement method in the
 PlatformOracle9iImpl.  Basically what this method is trying to do is
 unwrap the actual OraclePreparedStatement from the connections Statement
 (which will be different depending on the pooling technology).  Here is
 the configuration of how it searches (found in the PlatformOracle9iImpl
 class):

 /** Method names used by [EMAIL PROTECTED] #unwrapStatement}. */
 protected static final String UNWRAP_PS_METHOD_NAMES[] =
 {
 getInnermostDelegate  /* Commons DBCP */,
 getUnderlyingStatement/* JBoss */,
 getJDBC   /* P6Spy */
 };

 As you can see, XAPool (which is the connection pooling used by workflow
 for JTA purposes) is not represented in this list.  Therefore, it can't
 unwrap the statement and ends up deferring to the PlatformOracleImpl.

 We'll take a look into the best method for fixing this tomorrow but
 preliminary examination makes me think we may need to patch the ojb jar
 or subclass the PlatformOracle9iImpl and add support for XAPool.

It would be nice if you could add an enhancement issue in JIRA for
this with the changes attached, so that other can benefit from your
findings.

cheers,
Tom

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



Re: setup-db problems

2006-02-28 Thread Thomas Dudziak
On 3/1/06, Laurent Sacaut [EMAIL PROTECTED] wrote:

 I tested the sql statements generated by torque in project--schema under
 build/database directly in the mysql command-line AND using mysqlcc and
 they work just fine.

Please use a tool that uses the JDBC driver, e.g. Squirrel SQL, or
Ant's sql task.

 I then created a small java class with a simple jdbc connection to run
 the same statment and i got some interesting results.

 When I use the executeQuery method such as stmt.executeQuery(sSQL); a
 similar error as mentioned in the original post stating that there is a
 syntax error or access violation. (I used a user/password combination
 that had rights to do so)
 Then I tried the executeUpdate method.

 I get no error when each statement is passed to the method separately.
 When I feed the whole file as a string, such as the 'drop table if
 exists ...' statement and the 'create table ...' statement separated by
 a semi-colon (;), I get a syntax error near the ';', which seems to make
 sense since the javadoc on the Statement java class does not mention
 that it can process multiple sql statements.

 I would think Torque would be able to handle this situation, maybe I am
 missing a library.

That is to be expected because AFAIK Torque does not execute the
generated SQL in one execute call but rather splits them.

 It seems that I am running into a parsing problem. I noticed that
 ojb-blank does not contain xercesImpl.jar, so I added one from another
 project but the version of it might be more or less compatible.
 How come the build-torque file refers to libraries that are not present
 in ojb-blank?

This is because its quite big, and all newer java distributions
contain an XML parser (I don't think Torque specifically needs Xerces,
they only require an XML parser), so there is usually no need to
include it into ojb-blank. Btw, you would have encountered an XML
parser way before these SQL problems - in fact you should not get that
far at all if you miss an XML parser.

Tom

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



Re: setup-db problems

2006-02-27 Thread Thomas Dudziak
On 2/24/06, Laurent Sacaut [EMAIL PROTECTED] wrote:
 When trying to run the setup-db ant task from the build file, I am
 getting an error coming from the build-torque.xml file.
 I modified builds.properties and OJB.properties to fit my test project
 but can get it to run.

 I created the database first in MySQL 5.0
 I am able to build the project. But when I run setup-db, here is the log
 from the console:

What are the settings that you feed to Torque (e.g. mysql profile, or
build.properties when using ojb-blank) ?

Tom

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



Re: setup-db problems

2006-02-27 Thread Thomas Dudziak
On 2/27/06, Laurent Sacaut [EMAIL PROTECTED] wrote:

 Here are the settings from build.properties in ojb:

snip

These all look ok.

 I left the build-torque.xml file untouched, but I noticed that in the
 path id=torque-classpath section, it is trying to include files I
 don't have such as
 commons-lang-1.0.1.jar-- using commons.lang.1.2.1.jar instead
 village-2.0-dev-20030825.jar
 xercesImpl-2.0.2.jar -- using xerces.jar instead
 xmlParserAPIs-2.0.2.jar

Yep, that's ok.

 Any idea or suggestions?

It's a bit strange, the SQL that MySql complains about (CREATE TABLE
Client ...), works without problems in MySQL 4.1.
Could you try to execute the SQL that Torque generated (in
build/database) manually via the mysql commandline ? If that fails,
could you send me the SQL (off the list if you want) ?

Tom

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



Re: Oracle 10g compliance

2006-02-21 Thread Thomas Dudziak
On 2/21/06, Bruno CROS [EMAIL PROTECTED] wrote:

 Apparently, 1.0.4 does not support Oracle 10g platform (torque does but not
 the OJB runtime)

 So, i go on with oracle 9i settings. Does anyone report experience (good or
 bad) of that ?

OJB does work just fine with 10g. As far as OJB is concerned, there is
no relevant difference between 9i and 10g, so you should be fine with
the 9i platform.

Tom

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



Re: Migrating to 1.0.4

2006-02-03 Thread Thomas Dudziak
On 2/3/06, Bruno CROS [EMAIL PROTECTED] wrote:
 Following the Armin's advice, i'm currently migrating from 1.0.1 to 1.0.4

 I started with the 1.0.4 ojb-blank.jar to replace all files. jar of course,
 and configuration ones too.

 I stop with Torque (to generate Oracle 9i database) with an
 UnkonwnHostException

 In 1.0.1 i was targeting with this ( and it used to work fine):
 torque.database.createUrl=${urlProtocol}:${urlSubprotocol}:${urlDbalias}
 torque.database.buildUrl=${urlProtocol}:${urlSubprotocol}:${urlDbalias}

 and in 1.0.4, i tried the original one (with database) and the old one
 torque.database.createUrl=${urlProtocol}:${urlSubprotocol}:${urlDbalias}
 and
 torque.database.buildUrl=${torque.database.createUrl} (apprently the same)

 Did someone reach to work with torque and Oracle 9i ?

The new Torque version that OJB 1.0.4 employs, apparently has a change
that affects Oracle. See this thread for some details:

http://marc.theaimsgroup.com/?l=ojb-userm=113859243118171w=2

Tom

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



Re: Migrating to 1.0.4

2006-02-03 Thread Thomas Dudziak
On 2/3/06, Bruno CROS [EMAIL PROTECTED] wrote:

 sorry, can't see the link with the thread you gave me.

Why not ? Alternatively, you could use the user mailing list archive
link on the OJB site, and check the threads for 30 Jan. The Thread is
called Problems upgrading to ojb1.04.

 There is profile file in 1.0.4 OJB bin release. One of these is called
 oracle9i. I supposed that my build.properties (taken from obj-blank.jar)
 have to look like it. But i really don't known what i have  to put in this
 build.properties.  I read  somewhere that i have to select a profile, but i
 do not see a profile key at all. only torque.database ,
 torque.database.createUrl, and torque.database.buildUrl.

Could you post the error message ?

 I saw a patch to torque.jar too. Do i have to apply it ?

You should be safe if you use the jars that OJB comes with, because
that's the ones that OJB is (unit-) tested with.

Tom

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



Re: Migrating to 1.0.4

2006-02-03 Thread Thomas Dudziak
On 2/3/06, Bruno CROS [EMAIL PROTECTED] wrote:

 First you will find the ant trace of setup-db task, the torque error is
 painted in red.
 Second, you will find my build.properties used by the task.


  [torque-sql] 2006-02-03 13:21:48,578 [main] INFO
 org.apache.torque.engine.database.transform.DTDResolver - Resolver: used
 'http://db.apache.org/torque/dtd/database_3_0_1.dtd'
   StdErr

  BUILD FAILED
  build-torque.xml :
 file:C:/@Dev/Mathieu/ojb/src/schema/build-torque.xml:203:
 org.apache.torque.engine .EngineException: java.net.UnknownHostException:
 db.apache.org en ligne 203

This seems to be the core problem: Ant cannot access the server
hosting the DTD (db.apache.org), probably because of a Firewall. In
the Ant target that generates the schema, you can specify the DTD to
use for the schema. There, I thiink, you should use the value

http://db.apache.org/torque/dtd/database_3_1.dtd

because that should be the one that is contained in the torque jar
(which Ant therefore does not have to fetch from the internet).

Tom

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



Re: Migrating to 1.0.4

2006-02-03 Thread Thomas Dudziak
On 2/3/06, Bruno CROS [EMAIL PROTECTED] wrote:

 i 'm afraid i need to repatch distributed torque-gen-3.1.1.jar  to  have
 TIMESTAMP  jdbc type created for  java.sql.Date and java.sql.timestamp as i
 wrote in an old old post. (specific to oracle 9i and older )

You might want to try DdlUtils (http://db.apache.org/ddlutils) instead
of Torque, it uses the same schema format and contains an Oracle9 (and
an Oracle10 one) platform that can use TIMESTAMP.

Tom

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



Re: Problems upgrading to ojb1.04

2006-02-01 Thread Thomas Dudziak
On 2/1/06, Milisic Aleksandar [EMAIL PROTECTED] wrote:
 Problem solved. For future reference if anybody runs
 into this problem, the torque.delimiter in
 build-torque.xml needs to be set to / since the
 generated SQL uses the / to separate sql statements.

 Perhaps this should be somewhere in documentation,
 since it's definitely a change compared to the
 behaviour in ojb1.03?

This probably is a change in Torque then, not in OJB (and an
Oracle-specific one because for other databases this error did not
occur).

Tom

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



Re: Problem with OJB and Oracle9i

2006-01-30 Thread Thomas Dudziak
FWIW, DBCP seems to have some problems with Oracle (at least I had
some issues where the poolable connection waited forever for a new
connection). You might be better of using the datasource supplied by
the Oracle jdbc driver.

Tom

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



Re: Problems upgrading to ojb1.04

2006-01-30 Thread Thomas Dudziak
On 1/31/06, Milisic Aleksandar [EMAIL PROTECTED] wrote:

 Unfortunately, I have run into a different problem. I
 am so bewildered by it that I started another small
 project in one of the ojb-blank environments for
 ojb1.04 to test this out and make sure it has nothing
 to do with my environment.
 It seems that the generated SQL has syntax errors in
 it, I just can't figure out what is causing it. The
 differences I see compared to version 1.03 is that in
 build.xml dtdUrl is different as well as the torque
 version. The one I am using with ojb1.04 is
 torque-gen-3.1.1.jar.

snip

You could try DdlUtils (http://db.apache.org/ddlutils) instead of
Torque for generating the database, it might work better.

Tom

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



Re: Tomcat 5, JNDI, Perm Gen Memory leak

2006-01-26 Thread Thomas Dudziak
Hi folks,

after some serious profiling (and finding a bug in the Mustang b68
VM), I've added some additional cleanup calls to OJB (SVN of the
stable branch). Please give it a try to see whether that suffices.
However, you also need to do some work in your own webapp to ensure
proper cleanup. The standard way is to use a servlet context listener
like this (based upon Rick's test webapp):

public class CleanupListener implements ServletContextListener
{
  public void contextInitialized(ServletContextEvent event)
  { }

  public void contextDestroyed(ServletContextEvent event)
  {
PersistenceBrokerFactory.shutdown();
LogFactory.releaseAll();

for (Enumeration e = DriverManager.getDrivers(); e.hasMoreElements();)
{
  Driver driver = (Driver)e.nextElement();

  if (driver.getClass().getClassLoader() == getClass().getClassLoader())
  {
try
{
  DriverManager.deregisterDriver(driver);
}
catch (SQLException ex)
{
ex.printStackTrace();
}
  }
}
  }
}


What this does is basically performing OJB cleanup, commons-logging
cleanup, and cleanup of all JDBC drivers loaded in the webapp (which
is for instance necessary for the MySql driver).

For more info see also here:

http://opensource2.atlassian.com/confluence/spring/pages/viewpage.action?pageId=2669

Tom

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



Re: big data postgres platform

2006-01-25 Thread Thomas Dudziak
On 1/25/06, Jean-Yves Sironneau [EMAIL PROTECTED] wrote:

 I have a question regarding the handling of large data with ojb on the
 Postgres platform.

 - I think Blobs are not supported on this platform, is that true ?
 - What is the best way to tell ojb to fetch the data from a field on each
 access to the field ?
 - Is that better to manage that issue by hand

 Right now i have an array of bytes as the field corresponding to the big
 content, it's
 working pertty well except that i get Out of memory errors because the data
 stays on the heap.

I think, the Postgres driver (at least the new 8 ones) have no
problems handling BYTEA columns with the JDBC Blob interface, so you
should be able to tell OJB its a Blob and use BYTEA in the database.

Tom

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



Re: Problem with OJB and Oracle9i

2006-01-25 Thread Thomas Dudziak
On 1/25/06, Fabbri Michele [EMAIL PROTECTED] wrote:

 I have a poblem using OJB 1.0.3 with Oracle9i, when I try to connect to
 datasource defined with jndi in tomcat 5, if I define the datasource in
 repository it works.

I'm no Oracle expert, so I'm not sure whether it helps, but you could
try the newest JDBC driver (I think 10.0.2 is the latest), and use
JDBC level 3 in the jdbc-connection-descriptor.

Tom

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



Re: Tomcat 5, JNDI, Perm Gen Memory leak

2006-01-24 Thread Thomas Dudziak
On 1/24/06, Rick Roman [EMAIL PROTECTED] wrote:
 I am using Tomcat 5.5.4. I am almost certain it is OJB. I created a
 stripped down context with the minimum classes needed to run OJB and
 could pin the memory increase to touching anything that initiallized
 OJB. I have also chased down other known offenders such as deregistering
 the database driver and logging.

Could you provide me a simple example web app ? I would profile/debug
it then to see what's wrong.

Tom

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



OJB in Maven repository

2006-01-10 Thread Thomas Dudziak
Hi folks,

I've put the 1.0.4 release into the maven repository. If all goes
well, it should be visible sometime tomorrow (if not earlier). Please
let me know whether it works (esp. the dependencies in the pom),
because I'm not a maven user myself, rather I've been strictly
following the release guide.

cheers,
Tom

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



Re: broken pipe?

2006-01-09 Thread Thomas Dudziak
On 1/9/06, Dennis Bekkering [EMAIL PROTECTED] wrote:
 wel that didn't help now it looks like this and that still doesn't help.
 What do I have to do? My customers go crazy over this and me too!!! I really
 don't know what to do anymore. On production I didn't switch to
 1.0.4because lazy loading is different and the site gets to slow then.

Please try the custom initializationCheck attribute that I wrote about earlier:

http://db.apache.org/ojb/docu/guides/repository.html#Attributes-N10127

You could also write a minimalistic JDBC test that simply runs over
night and performs the SELECT 1 every second or so, in order to test
whether you have some MySql setup problem.

Tom

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



Re: broken pipe?

2006-01-09 Thread Thomas Dudziak
On 1/9/06, Dennis Bekkering [EMAIL PROTECTED] wrote:

 The whole thing looks like this now, I don't use 1.0.4 though on production.
 Does the attribute do anything then. It runs on rc7.

The custom attribute is new in 1.0.4, so it won't do anyting in older versions.
I'd suggest you first update to 1.0.3 (there shouldn't have been too
many changes regarding lazy loading) and see how that works.
Btw, you should use jdbc level 3 for the mysql driver, and update to
the newest driver (3.1), there have been a lot of changes AFAIK.

Tom

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



Re: Strange Exception

2006-01-09 Thread Thomas Dudziak
On 1/9/06, Zhong Li [EMAIL PROTECTED] wrote:

 Our application runs for a few weeks, today I got exceptions, The strange
 thing is, the application can query, delete and save, but not insert (
 create new Object). We use OJB 1.0.3. From exception, it seems run out of
 connections. But question is why still can query, delete and save(exist
 Object)?

This might be a timeout issue, e.g. all connections in the pool timed
out. You might want to define a connection validation query in your
connection pool definition, and add autoReconnect=true to your jdbc
connection url (i.e. add it to the dbalias in the JCD).

Tom

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



Re: broken pipe?

2006-01-05 Thread Thomas Dudziak
On 1/5/06, Dennis Bekkering [EMAIL PROTECTED] wrote:

 I asked my provider and they didn't change anything. They pointed out the
 possible absence of autoReconnect=true in my JDBC url. Does anybody knows if
 that might help. I'd rather have that than a ping query for every call.

Hmm, autoReconnect = true might be ignored by the MySql driver when
autoCommit is set to false for a transaction (e.g.
http://lists.mysql.com/java/4928).
This might be the case as the OJB doc for 1.0.4 suggests for your
setting of useAutoCommit = 1:

http://db.apache.org/ojb/docu/guides/repository.html#Attributes-N10127

You could try to set the custom attribute initializationCheck to true
(as the above link suggests).
Btw, I think (though I'm not sure) that the validation query is only
used when a connection is retrieved from the connection pool. You
could configrue one and check with P6Spy.

Tom

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



[FYI] OJB has moved from CVS to SVN

2006-01-03 Thread Thomas Dudziak
Hi,

just for your information, OJB is now on Subversion. I've updated the
links on the OJB website accordingly.
Here are some helpful links if you want to work with the bleeding edge OJB:

How to use Subversion @ Apache:
---

http://apache.org/dev/version-control.html


OJB Repositories:
-

1.0 stable:

http://svn.apache.org/repos/asf/db/ojb/branches/OJB_1_0_RELEASE/

Head (now called trunk):

http://svn.apache.org/repos/asf/db/ojb/trunk/


regards,
Tom

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



Re: broken pipe?

2006-01-03 Thread Thomas Dudziak
On 1/3/06, Dennis Bekkering [EMAIL PROTECTED] wrote:
 Hello,

 I suddenly out of the blue get the following trace. It happens sometimes not
 all the time. Does anybody knows what this means. And what can be done about
 it?

 rethrown as org.apache.ojb.broker.PersistenceBrokerSQLException:
 Communications link failure due to underlying exception: ** BEGIN NESTED
 EXCEPTION ** java.net.SocketException MESSAGE: Broken pipe STACKTRACE:
 java.net.SocketException: Broken pipe at
 java.net.SocketOutputStream.socketWrite0(Native Method) at
 java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at
 java.net.SocketOutputStream.write(SocketOutputStream.java:136) at
 java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65) at
 java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123) at
 com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2618) at

This is a common MySql error that has to do with TCP/IP timeouts. See e.g. here

http://forums.mysql.com/read.php?39,42763,42767#msg-42767

What does your jdbc connection descriptor look like ?

Tom

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



[ANN] OJB 1.0.4 released

2006-01-01 Thread Thomas Dudziak
Hi folks,

The OJB team is happy to announce that OJB version 1.0.4 has (finally)
been released and should be available right now at a mirror near you.
This is a feature and bug-fix release:

-
Release 1.0.4
-
NEW FEATURES:
* Support for embedded  network Derby (only distinct count queries
don't work yet)
* Added ability to prepare the database for OJB's unit tests via
DdlUtils (instead of Torque)
  Note that this is required when running the tests against Derby
* [OJB-10] - Configurable Proxy generation (including CGLIB based generation)
* [OJB-31] - Configurable JDBC driver-setting setFetchSize
* [OJB-14] - Setting custom JDBC driver tuning options trough
jdbc-connection-descriptor
* [OJB-6]  - Support for stored procedures returning ResultSet.
* [OJB-41] - ODMG-api: Allow cascading delete using auto-delete
setting in metadata
* [OJB-66] - Allow to specify a sequence start element for
SequenceManagerNextValImpl.
  Fixed for Oracle, PostgreSQL, MaxDB/SapDB, DB2. Additionally
sequence properties
  like 'increment by', 'cache', 'order',... are supported too. See
'sequence manger'
  guide and javadoc
* Add new ODMG extensions and configuration properties. All properties
can be set
  at runtime as global property in class ImplementationExt and for a specific
  transaction in class TransactionExt:
  - 'ordering' Allow to dis-/enable OJB's object ordering on transaction commit
  - 'implicitLocking' Dis-/enable OJB's implicit locking
* Add new property 'TxCheck' in OJB.properties file. When enabled, on
PB store and
  delete calls OJB checks for a running PB-tx, if not found an error
is logged in order to
  avoid store/delete calls without a running PB-tx (while development).

NOTES:
* Internal OJB class configuration files are changed, don't forget to replace
  these files on upgrade from older version (by default the internal used
  classes are located in repository_internal.xml).
* Improved performance comparison tests ('ant perf-test' and 'ant performance').
  Now the tests more fair for registered API's
* In order to facilitate [OJB-10] the constructor signature of
VirtualProxy has been changed.

CHANGES:
* INTERNAL API CHANGES:
  Pluggable class interfaces changed to support and fix OJB-31, OJB-6, OJB-63:
  - StatementsForClassIF
  - StatementManagerIF
  - Platform
  - RowReader
  - SqlGenerator
* Configurable ProxyFactory is now available. Both JDK-based (default) and CGLIB
  are provided. CGLIB-based generation allows for proxies to be
generated for all
  persistent classes, and not just ones that implement an interface.
* Change in behavior of property 'useAutoCommit=1' in
jdbc-connection-descriptor
  detailed info can be found in reference guide of the repository file
* ConnectionFactoryManagedImpl is declared deprecated. Now OJB
automatic detect the
  running JTA-transaction and suppress critical method calls on the
used connection
* Removed deprecated SequenceManager implementation SequenceManagerMySQLImpl
* Remove unused method #setReferenceFKs from SequenceManager interface
* ODMG-api: Method behavior of
ImplementationImpl#setImplicitLocking(boolean) changed.
  Now this method set the global property for 'implicitLocking'. Old
version only changed the
  implicit locking behavior for the current used transaction, this is moved to
  TransactionExt#setImplicitLocking
* Internal used OJB_HL_SEQ table changed. Remove of deprecated column.
  If the SequenceManagerHighLowImpl was used and problems occur after
upgrade, please
  drop and recreate this table without removed column
* Cleanup naming of 'PersistentField' implementation classes: Remove
deprecated classes, rename
  implementation classes, declare all ...ImplNew classes as deprecated.
  See OJB.properties file.
* Upgraded ANTLR to v2.7.5 (OQL and JDOQL parser classes have been re-generated)
* Upgraded commons-dbcp to v1.2.1
* Upgraded commons-pool to v1.2
* Upgraded commons-beanutils to v1.7
* Upgraded commons-logging to v1.0.4
* Upgraded commons-collections to v3.1
* Upgraded hsql to v1.8.0.2
* Upgraded Torque to v3.1.1

BUG FIXES:
* [OJB-18] - ODMG ordering problem with circular/bidirectional 1:1 references
* [OJB-25] - Inheritance (each subclass on separate table) PK problem with
  nextval SequenceManager
* [OJB-26] - JDBC-ODBC bridge problem
* [OJB-27] - [ODMG] Foreign key violation
* [OJB-29] - Infinite loop in case of refresh=true and cycles in references
* [OJB-40] - CallableStatement check doesn't work with maxDB
* [OJB-42] - MsSQLServer, auto-generated querry error (m:n relation)
* [OJB-44] - ReferenceMap$Entry keeps growing over period of application usage.
* [OJB-52] - KeyConstraintViolatedException during store
* [OJB-54] - ConnectionFactoryManagedImpl may try to use pool
* [OJB-55] - Getting foreignkeyField's FieldDescriptor is failing if
the foreignkey
  field is defined in the base class
* [OJB-59] 

Re: rrayIndexOutOfBoundsException when updating objects

2005-12-29 Thread Thomas Dudziak
On 12/27/05, Vamsi Atluri [EMAIL PROTECTED] wrote:

 I am currently using ojb 1.0.1. I have a table with several references.
 The first time when I insert to this table everything inserts correctly.
 The next time, when I need to update this row, I retrieve the reference
 from DB, update the values and call broker.store() again. That's when I
 get the following error:

 java.lang.ArrayIndexOutOfBoundsException: 1
 at
 org.apache.ojb.broker.core.PersistenceBrokerImpl.setFKField(PersistenceBrokerImpl.java:1045)

This normally happens when the number of columns in a foreign key
(reference/collection) is not the same as the targeted primary key.
It would help if you post your respitory definition and the code that
exhibits the exception.

Tom

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



Re: otm transactions

2005-12-29 Thread Thomas Dudziak
On 12/27/05, Dennis Bekkering [EMAIL PROTECTED] wrote:

 I don't understand the following, how those the kit know if the connection
 already is in a transaction?

 public Iterator moreRealisticQueryByCriteria(Query query, int lock)
 {
  OTMKit kit = SimpleKit.getInstance();
  OTMConnection conn = null;
  Transaction tx = null;
  try
  {
  conn = 
 kit.acquireConnection(PersistenceBrokerFactory.getDefaultKey());
  tx = kit.getTransaction(conn);
  boolean auto = ! tx.isInProgress();
  if (auto) tx.begin();
  Iterator results = conn.getIteratorByQuery(query, lock);
  if (auto) tx.commit();
  return results;
  }
  finally
  {
  conn.close();
  }
 }

I'm not too familiar with OTM, but this should depend on how/where the
transaction is handled, e.g. how your database access and how OJB are
configured.

Tom

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



Re: What about JDO project ?

2005-12-29 Thread Thomas Dudziak
On 12/22/05, Hale India [EMAIL PROTECTED] wrote:

  I use OJB in our project and we are very happy with it.
  I just see in news that a jdo project has been created in the apache Db 
 Project.
  I saw that it is question to implement JSR 243 and that the reference 
 implementation is jpox :
  http://www.jpox.org
  On Jpox project i see that they intend to implement JDO 2.0 and that JPOX 
 will be updated in future to also implement any EJB3 specification of Java 
 persistence.

  All that seems good news.

  What about OJB future in the middle of that ?

Nothing official, but given that Jpox is really a good JDO2
implementation with an Apache license, I would think that a JDO2
implementation for OJB might not be too useful anymore.

Tom

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



Re: MS Access

2005-12-22 Thread Thomas Dudziak
On 12/22/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Ack!  I've had no problem using OJB with MSAccess as long as I use
 MyEclipse, but as soon as I try to run without it, I get this error in
 the Tomcat log:

This might be a problem with multiple connections because AFAIK MS
Access only allows at most one connection at any given time. I think
you have to synchronize the database access in your app (so that not
more than one thread can access the database simultaneously) and use a
non-poolable data source (so that no connections are hold open in the
pool).

Tom

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



Re: Help needed regarding updating objects.

2005-12-21 Thread Thomas Dudziak
I wonder, why do you clear the cache prior to storing the objects ?
And you need transactions around the store call.

Tom

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



Re: Help needed regarding updating objects.

2005-12-20 Thread Thomas Dudziak
On 12/19/05, Vamsi Atluri [EMAIL PROTECTED] wrote:

 CREATE TABLE A (
 A_ID INTEGER NOT NULL,
 B_ID INTEGER,
 X_ID INTEGER,
 Y_ID INTEGER,
 A_NAME VARCHAR (40),
 CONSTRAINT A_PK PRIMARY KEY (A_ID),
 CONSTRAINT A_FK1 FOREIGN KEY (B_ID, X_ID, Y_ID)
  REFERENCES B (B_ID, X_ID, Y_ID)
 );

 CREATE TABLE B (
 B_ID INTEGER INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY( START 
 WITH 1,
 INCREMENT BY 1, NO CACHE),
 X_ID NOT NULL,
 Y_ID NOT NULL,
 B_NAME VARCHAR (40),
 CONSTRAINT B_PK PRIMARY KEY (B_ID, X_ID, Y_ID)
 )

snip

 jdbc-connection-descriptor
 jcd-alias=OJBDb
 default-connection=true
 platform=Db2
 jdbc-level=1.0
 jndi-datasource-name=jdbc/ojbDataSource
 username=uid
 password=pwd
 batch-mode=false
 useAutoCommit=0
 ignoreAutoCommitExceptions=false
 sequence-manager
 className=org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl
 attribute attribute-name=grabSize 
 attribute-value=1/attribute
 /sequence-manager
 /jdbc-connection-descriptor

 class-descriptor class=A table=A
 field-descriptor name=aId column=A_ID primarykey=true
 jdbc-type=INTEGER /
 field-descriptor name=bId column=b_ID jdbc-type=INTEGER /
 field-descriptor name=xId column=X_ID jdbc-type=INTEGER /
 field-descriptor name=yId column=Y_ID jdbc-type=INTEGER /
 field-descriptor name=aName column=A_NAME jdbc-type=VARCHAR
 length=40 /
 reference-descriptor name=b class-ref=B
 foreignkey field-ref=bId /
 foreignkey field-ref=xId /
 foreignkey field-ref=yId /
 /reference-descriptor
 /class-descriptor


The problem might be that you're using the native sequence manager,
but table A has no identity manager. Could you check whether a
different sequence manager works ?

Tom

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



Re: How to execute code before persisting an object

2005-12-05 Thread Thomas Dudziak
On 12/5/05, Christopher C. Worley [EMAIL PROTECTED] wrote:
 I would like to perform operations on an object before the object is
 persisted.  One thing I would like to do is set a transactionDate
 field.  I want the field to be set on the server side so all records can
 be set to the same date.  What I mean by that is I do not want to set
 the date as the user flips through wizard pages and have the dates vary
 by seconds.

You could implement PersistenceBrokerAware:

http://db.apache.org/ojb/docu/guides/advanced-technique.html#Instance+Callbacks

but in your case it actually might be more useful to let the database
do this (e.g. a timestamp column or one backed by a sequence) ?

Tom

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



Re: Can OJB Be Built w/GCJ 3.3.x?

2005-12-01 Thread Thomas Dudziak
On 12/1/05, Craig A. Vanderborgh [EMAIL PROTECTED] wrote:

 We need to build OJB using gcj 3.3.2 for an embedded system.  Is it
 possible?  What experiences have people had using OJB w/gcj 3.3.x?

Never tried it, but I think with the newer gcj versions this should be
doable. You should check however for prebuilds of the libraries that
OJB uses (e.g. commons-lang, commons-collections etc.), usually there
are some available or at least steps to get them to compile.
On second thought, I think your main problem will be the JDBC driver, not OJB.

Tom

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



Re: Problem with interface

2005-11-29 Thread Thomas Dudziak
On 11/28/05, Joose Vettenranta [EMAIL PROTECTED] wrote:

 I have like this:

 public class A implements Foo {
   private Integer id;
   ...
   getter/setter..
 }

 public class B implements Foo {
   private Integer id;
   ...
   getter/setter..
 }

 public interface Foo {
 public Integer getId();
 public void setId();
 
 }

 Both A and B has unique id's.. so both can have values with id=5;

 When I do query to that Interface,  I get values for class B objects
 from class A objects if ID value is the same.

 Can I fix this somehow or do I have to use global unique id as
 primary key?

This depends on how you mapped these types. Please post your
repository xml file.

Tom

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



Re: MS Access

2005-11-21 Thread Thomas Dudziak
On 11/21/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Torque doesn't work with MS Access.  That just means you have to
 set up your test data manually.

You could add a feature request over at the DdlUtils JIRA
(issues.apache.org/jira/browse/DDLUTILS) for adding support for MS
Access. DdlUtils uses the same XML format as Torque, so switching over
is rather painless.

Tom

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



Re: When to overwrite equals() and hashCode()

2005-11-10 Thread Thomas Dudziak
On 11/10/05, werner [EMAIL PROTECTED] wrote:

 I'm using OJB 1.0.3 with PB-API and it'S doing a great job. Now I'm
 looking for some information about the equals() and hashCode() methods:
 - In which cases should they be overwritten?

In general it is a good idea to overwrite these methods because
persistent objects (read from/written to a database) tend to have
value semantics, e.g. two objects are not only equal if they are
identical (as with the default equals implementation), but rather if
they have the same state (field values).

 - How can hashCode() be implemented? Can I use just the Primary Key for
 the hashcode, or does that cause problems?

You should only do that if your app controls the pk values. If OJB or
the database creates them, then this will cause problems with
yet-unwritten objects which obviously don't have pk values yet.

Tom

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



Re: When to overwrite equals() and hashCode()

2005-11-10 Thread Thomas Dudziak
On 11/10/05, werner [EMAIL PROTECTED] wrote:

 Thanks for your answer. The hashCode function is a little mystery to me.
 I use a standard database setup where every table has a primary key
 (auto increment integer). Is it a proper solution to add the hashcode of
 all fields except the primary and return the result as the new hashcode
 of the object? What happens if I create 2 new objects with empty fields.
 They would always be considered as equal until I put some data into the
 object. So I think it wouldn't work.

The basic contract defined in java.lang.Object is that if two objects
are consided equal by the equals() method than they shall have the
same hash code (have a look at the javadoc of Object).
The method that I generally use is to use the hashcode builder from
commons-lang:

http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/builder/HashCodeBuilder.html

The basic usage pattern is that you append all fields to the builder
that you also use in the equals method.

Tom

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



Re: PlatformInformixImpl

2005-11-09 Thread Thomas Dudziak
On 11/9/05, Thomas Franke [EMAIL PROTECTED] wrote:

 I implemented the prepareNextValProcedureStatement() method in the class 
 above.
 Now the SequenceManagerStoredProcedureImpl works also together with Informix.
 This implementation is tested against Informix Dynamik Server 9.4 and the
 Informix JDBC.3.00.JC1 driver.

 I attached also the sql statements to create the spl function and the OJB
 sequence table.

 Maybe you can use it.

Thanks!
Could you perhaps create a feature request in JIRA and attach the source there ?
Would you be willing to run the unit tests when we cut new releases ?

Tom

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



Re: PlatformInformixImpl

2005-11-09 Thread Thomas Dudziak
On 11/9/05, Thomas Franke [EMAIL PROTECTED] wrote:

 Yes, I will both of them.
 But I could need a little help. Where can I do the first one?

Usually you would do so here:

http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10700

but this seems to be down at the moment. But I guess it will be online
again in a couple of hours.

Tom

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



Re: PB linking problem

2005-11-04 Thread Thomas Dudziak
On 11/4/05, Daniel Perry [EMAIL PROTECTED] wrote:
 Not sure if this is really an bug, or just a 'feature', but things dont get
 linked under certain curcumstances.

 I have two objects: activity, and attachment.

 An activity has a collection of attachments.

 /**
  * @ojb.collection element-class-ref=com.netcase.pol.bo.Attachment
  * foreignkey=activityId
  *
 query-customizer=com.netcase.ojb.NotDeletedQueryCustomizer
  * proxy=true auto-retrieve=true 
 auto-update=object
  */
 private ListAttachment attachments;

 (attachment has: @ojb.field name=activityId jdbc-type=INTEGER)

 The following works: (ie, activityId is set properly)
 1. persist an attachment.
 2. add it to the collection in activity.
 3. persist activity.

 However, if i add the following to attachment:
 /**
  * @ojb.reference foreignkey=activityId
  */
 private Activity activity;

 then the above doesnt work.  activityId ends up as 0.  I guess i should
 expect this as activity is null.  But, still, as activity is being persisted
 last, shouldnt it be updated for that link?

I think you have to set the activity field in your code initially
(before writing). OJB will initialize the field only when reading
objects from the database (and it doesn't do so in between storing the
collection and the reference).

Tom

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



Re: I/O Error: Socket closed

2005-11-03 Thread Thomas Dudziak
On 11/3/05, Charles Harvey III [EMAIL PROTECTED] wrote:

 Wow.  Figured it out.  This goes back to my Impossibly long insert
 time for one object e-mail conversation from last week.

 I actually found a bug.


   org.apache.ojb.broker.platforms.PlatformMsSQLServerImpl

 This method to be exact:
  getLastInsertIdentityQuery(java.lang.String tableName)

 It returns a string that says:
 SELECT @@IDENTITY FROM  + tableName;

 This, is in fact, incorrect.

 It should be:
 SELECT @@IDENTITY;


 Depending on table size, this query can run for MINUTES.  As it
 was doing for me.  Try it out.  Open up a query browser and
 run this:

   INSERT INTO TABLE (...) VALUES (...) SELECT @@IDENTITY FROM TABLE

 And then compare to this:

   INSERT INTO TABLE (...) VALUES (...) SELECT @@IDENTITY

 Its silly, but the difference is huge.  The first one scans every
 row in the database, printing out 'null' for every row, then spits
 out the last identity at the end.  In a table of 9 million rows, this
 ran for 15 minutes.  Take the FROM TABLE off and it pulls the
 identity value from a system table and returns in .0001 ms.

 So.  What do I do now?  I modified my local version and re-deployed.
 Problem solved.  Whew.  No more locking, socket closings and applications
 falling over and shutting down.

 Is there a place where I can attach a bug report?  Can anyone else
 test this out to make sure I'm not nuts (I'm 99.99% I'm not).

Sure, just add one in OJB's JIRA:

http://issues.apache.org/jira/browse/OJB

if you happen to have a Sql Server 2000, could you test the IDENT_CURRENT method

SELECT IDENT_CURRENT(tableName)

it would have the benefit of returning the last inserted id for the
specified table, not for all tables as does @@IDENTITY (which might be
problematic in case of triggers etc.).

Tom

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



Re: testing issue

2005-11-02 Thread Thomas Dudziak
On 11/1/05, Warner Onstine [EMAIL PROTECTED] wrote:

 Sorry, (stupid gmail). The rest of my question when trying to connect
 with a test I get this error message:
 2005-10-31 16:49:54,927 [main] ERROR
 org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl ::
 Instantiation of jdbc driver failed
 java.lang.NullPointerException

I think you get this exception because you're not using the correct
connection factory (you seem to use ConnectionFactoryPooledImpl which
is not Spring-aware, and this connection factory uses the jdbc driver
directly).

Tom

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



Re: new cglib configuration/usage

2005-10-29 Thread Thomas Dudziak
On 10/29/05, Warner Onstine [EMAIL PROTECTED] wrote:
 Ok, So I finally got things converted to ojb-1.1.0 (is this correct,
 that's what gets built) and I went through OJB.properties and changed
 our relevant properties to match what was in cvs head. I also set the
 first test descriptor to proxy=dynamic and for good measure where it
 was referenced proxy=true. However it doesn't appear to be working.
 I have since tried it on other classes with the same results (ie -
 same number of queries being executed).

OJB 1.1.0 is CVS Head, you probably want to checkout the
OJB_1_0_RELEASE branch which is the upcoming 1.0.4 rc.

 So, I'm wondering if I'm missing a setting somewhere or if I need to
 declare something else in the descriptor.

 I added in these two lines into the OJB.properties file:
 ProxyFactoryClass=org.apache.ojb.broker.core.proxy.ProxyFactoryCGLIBImpl
 IndirectionHandlerClass=org.apache.ojb.broker.core.proxy.IndirectionHandlerCGLIBImpl
 (it looks like the last one isn't necessary, but when it failed to
 work I added in the second line in addition to the first).

Both are needed, I think.

The question is, what queries are generated. If they are for primary
keys only, then you're probably at the minimum already. Could you post
the significant part of the classes, repository, usage code and the
generated queries ?

Tom

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



Re: impossibly long insert time for one object

2005-10-28 Thread Thomas Dudziak
On 10/28/05, Charles Harvey III [EMAIL PROTECTED] wrote:
 I just ran a little test on this query.
 My test, wipe out all the data.  I am inserting into 3 tables when
 a user takes a quiz.  Each had close to or over a million rows.  So,
 I wiped 'em out.  Than ran it again.  Works like a charm.

 Something in the insert is making it take minutes to commit.  And, I
 think it is the @@IDENTITY.

 I have to take a look at the code for the PlatformMsSQLServerImpl.
 But from looking at the sql profiler I can see that when it does an
 insert it also selects the @@IDENTITY AS id so that it can return
 the id to the newly created object.

 For some reason, that @@IDENTITY part takes minutes when there are
 close to a million rows.  This is probably a SQL Server problem and
 not an OJB problem.  But, does anyone have an idea on how I could
 get around this problem?

If you have an Sql Server 2000, you could try the alternatives to @@IDENTITY:

http://www.sqlteam.com/item.asp?ItemID=319

e.g. SCOPE_IDENTITY() might be faster ?

Tom

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



Re: which version of spring will support cvs head?

2005-10-27 Thread Thomas Dudziak
On 10/27/05, Warner Onstine [EMAIL PROTECTED] wrote:

 Hopefully a quick question, we are currently using spring 1.1.5, but
 this appears to break with the latest from head (1.1.0 ?). I have
 dropped in spring 1.2.5 and it appears to support what's in CVS I just
 wanted to make sure.

Yep, in general you should use the 1.2 line of Spring with OJB, though
the 1.0.x versions should still work nicely with 1.1.5.

Tom

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



Re: MS Access

2005-10-27 Thread Thomas Dudziak
On 10/27/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Has anybody created a test database using Microsoft Access?  When I run
 ant prepare-testdb with MySQL, it works fine, but when I switch to
 MSAccess, it gets this error:
 C:\Java\db-ojb-1.0.3\ojb-blank\src\schema\build-torque.xml:300:
 Exception thrown by 'generator.parse'.
 For more information consult the velocity log, or invoke ant with the
 -debug flag.

You might want to check the Torque mailing list archives on what
database type you should use if it supports Access at all.

Tom

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



Re: Inheritance using special attribute ojbConcreteClass issue

2005-10-26 Thread Thomas Dudziak
On 10/26/05, Bernd Laengerich [EMAIL PROTECTED] wrote:
 Thomas Dudziak wrote:

  I think the error comes from the XDoclet module, not from Torque.
  The problem is that you should not redefine the field in the subclass

 I haven't redefined it in the java code, so you think it should not
 appear in the repository xml for the subclass?

Oh, yes, I missed the BaseB part.
So you're mapping unrelated inheritance hierarchies onto the same
table ? I'm not sure whether that works in all instances (think:
queries for the base classes, collections that refer to one of the
base classes), but if you say that OJB works without problems, then
all the better.
As for the error message, for now you can turn off the XDoclet check
using the checks attribute as described here:

http://db.apache.org/ojb/docu/guides/xdoclet-module.html#Usage

Please be so kind and add an issue for this in OJB's JIRA, attaching
the sample source code and error message/stack trace.

Tom

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



Re: proxy question

2005-10-26 Thread Thomas Dudziak
On 10/26/05, Warner Onstine [EMAIL PROTECTED] wrote:

 Ok, I'm working on implementing the custom proxy class and am having
 some issues. When I try and use my custom Proxy class I get the
 following:

 Unable to create proxy using class:org.kuali.module.chart.bo.AccountProxy

 AccountProxy extends the VirtualProxy class and implements my
 interface that I want. I also added in the following constructor:
 public AccountProxy(IndirectionHandler handler) {
 super(handler);
 }

 After I initially got the error message. In the docs it references
 another constructor that accepts an Identity and PersistenceBroker,
 but this no longer seems to be the right way to do this, is this
 correct?

In the unit tests there is an example of such a proxy:

http://cvs.apache.org/viewcvs.cgi/db-ojb/src/test/org/apache/ojb/broker/ProductGroupProxy.java?rev=1.5.2.3view=markup

I haven't checked the docs, but if you say that there are no longer
valid, please add an issue to OJB's JIRA so that we do not forget to
update them for the next release.

Tom

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



Re: Inheritance using special attribute ojbConcreteClass issue

2005-10-26 Thread Thomas Dudziak
On 10/26/05, Bernd Laengerich [EMAIL PROTECTED] wrote:

  As for the error message, for now you can turn off the XDoclet check
  using the checks attribute as described here:#

 It's not XDoclet complaining, but Torque, so is this a Torque issue?
 The error message and stack trace (with -debug) is:

Might be either the XDoclet module or Torque. Could you post the
generated repository file ?

Tom

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



Re: proxy question

2005-10-26 Thread Thomas Dudziak
On 10/26/05, Warner Onstine [EMAIL PROTECTED] wrote:

 Well, I was hoping that that would do the trick but no dice. I'm still
 getting the error that it cannot create a proxy using my proxy class.

snip

 Caused by: java.lang.NoSuchMethodException:
 org.kuali.module.chart.bo.AccountProxy.init(java.lang.reflect.InvocationHandler)
 at java.lang.Class.getConstructor0(Class.java:1937)
 at java.lang.Class.getDeclaredConstructor(Class.java:1301)
 at 
 org.apache.ojb.broker.core.proxy.VirtualProxy.createProxy(VirtualProxy.java:116)

 I have now implemented the following constructors (and the
 Serializable interface per the unit test):
 public AccountProxy(){
 super();
 }

 public AccountProxy(PBKey key, Identity uniqueId) {
 super(key, uniqueId);
 }

 public AccountProxy(IndirectionHandler handler) {
 super(handler);
 }

 Any other ideas?

Could it be that you have some classpath problem there ? The exception
(and the corresponding source code of VirtualProxy) state that a
constructor with a single argument of IndirectionHandler is searched
for in your class, but could not be found.

Tom

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



Re: proxy question

2005-10-26 Thread Thomas Dudziak
On 10/27/05, Warner Onstine [EMAIL PROTECTED] wrote:

 Alright so it does appear to have been caused by some weird classpath
 issue. But now I'm running into another problem.

 org.apache.ojb.broker.PersistenceBrokerException:
 org.apache.ojb.broker.PersistenceBrokerException: Error invoking
 method toString
 at 
 org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.materializeSubject(IndirectionHandlerDefaultImpl.java:384)
 at 
 org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.getRealSubject(IndirectionHandlerDefaultImpl.java:348)
 at 
 org.apache.ojb.broker.core.proxy.VirtualProxy.getRealSubject(VirtualProxy.java:135)

You could debug these methods to see whether the call

Object realSubject = broker.getObjectByIdentity(id);

that is in materializeSubject actually retrieves an object or not
(thus you'd end up with a null value).

Tom

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



Re: M:N storage removes duplicate elements

2005-10-26 Thread Thomas Dudziak
On 10/27/05, Jason A. Lunn [EMAIL PROTECTED] wrote:
  I have an indirection table foo_bar that happily implements an
 m:n relationship between foo and bar. the columns of foo_bar include
 foo_id, bar_id, and a unique id for the association itself (mysql
 backend, the id column is inserted automatically). This is because it
 is relevant to my application to materialize references to the same
 object at different indices of the collection upon retrieval.

 I started out doing all the insertion into this table by hand. When I
 retrieve foo or bar, I successfully get a collection containing all
 the expected elements at all the right indices. But now I'm trying to
 get more sophisticated, and thus writing an online editor for this
 relationship instead of populating the foo_bar table through the
 mysql command line. What I'm finding is that OJB is deduping my
 collection by ignoring successive references to elements it has
 already seen in the current transaction. The result is that I don't
 get as many rows inserted into my indirection table as I want.

 For instance:

  Foo foo1 = new Foo();
  Bar bar1 = new Bar();

  broker.beginTransaction();
  broker.store( bar1 );
  broker.store( foo1 );

  bar1.getFoos().add( foo1 );
  bar1.getFoos().add( foo1 );

  broker.store( bar1 );
  broker.commitTransaction();

 I would expect the above to result in an insert into the foo table,
 an insert into the bar table, and 2 insertions into the foo_bar
 table. I get the expected behavior in the foo and bar tables, but I
 only get one new record into the foo_bar table.

 Someone I know suggested that I manually iterate over the collection
 using the link() and unlink() methods of BrokerHelper, but I was
 convinced that there was a more elegant way to do this, possibly a
 configuration file tweak to tell OJB to create multiple links in the
 indirection table rather than assuming that I only want one.

 Your thoughts appreciated.

How is the indirection table defined in the database ? Is there a
compound primary key defined over the columns used to refer to the two
classes ?
Also, you could configure P6Spy to trace the generated SQL in order to
see whether OJB or the database ignores the second insert. Details on
how to configure P6Spy can be found here:

http://db.apache.org/ojb/docu/faq.html#traceProfileSQL

Tom

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



Re: Inheritance using Torque

2005-10-25 Thread Thomas Dudziak
On 10/24/05, Angel Cepa Pandiella [EMAIL PROTECTED] wrote:

 I need to map inheritance as described in
 http://db.apache.org/ojb/docu/guides/advanced-technique.html#Mapping+Classes
 +on+Multiple+Joined+Tables but I have to generate the ojb schema from a
 Torque one. I use Torque to generate the ojb schema  the database structure
 automatically.

 Anyone knows how is the Torque schema that genetates the ojb one of the
 link? I read some Torque documentation but there aren't examples available.

It's basically only the sum of the columns for the fields per
class-descriptor, so in the specific case you'd have table A_TABLE
with columns ID and VALUE_, and table B_TABLE with columns ID and
VALUE_ (for the fields id and someValueFromB from class B).
You might also add a foreignkey to table B, that points to A using ID
for both the local and remote column.

Tom

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



Re: Inheritance using special attribute ojbConcreteClass issue

2005-10-25 Thread Thomas Dudziak
On 10/25/05, Bernd Laengerich [EMAIL PROTECTED] wrote:
 Hi,

 is there any way to tell OJB to use a different attribute name for a
 specific class instead of ojbConcreteClass?

 The problem is, I have a table A with objects of two different classes
 A und B (both using inheritance) instantiated from it.

 Torque refuses the datasql target with the error:
 Attribute OjbConcreteClass was already specified for element ATABLE.
 OJB itself is working fine with it.

I think the error comes from the XDoclet module, not from Torque.
The problem is that you should not redefine the field in the subclass
(you don't have to, anyway, as its protected and thus already visible
in the subclass), because when using reflection there is no guarantee
which one (of the base class or the sub class) is used.
The usual pattern is to define the field in the base class, and
initialize it either directly on in the constructor, like so:

private String ojbConcreteClass = getClass();

Btw, this way you don't even have to make it protected as the
subclasses don't do much with it anyway.

Tom

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



Re: proxy question

2005-10-25 Thread Thomas Dudziak
On 10/25/05, Warner Onstine [EMAIL PROTECTED] wrote:
 Hi all,
 This is my first project using OJB so forgive me if this is a simple
 question, however I can't find anything specific in the docs for this.

 Currently we have an object called Account which extends another object
 called BusinessObjectBase. We want to use proxying for any place where the
 Account class is referenced so we created an AccountProxy interface class
 that Account implements and then set the proxy=dynamic for the class
 declaration.

 When we run the program we get the following error message:
 org.springframework.orm.ojb.OjbOperationException: OJB operation failed;
 nested exception is org.apache.ojb.broker.PersistenceBrokerException: Error
 invoking method toString
 org.apache.ojb.broker.PersistenceBrokerException: Error invoking method
 toString
 at org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.invoke(
 IndirectionHandlerDefaultImpl.java:334)
 at $Proxy31.toString(Unknown Source)
 at java.lang.String.valueOf(String.java:2131)
 at java.lang.StringBuffer.append(StringBuffer.java:370)

 There is a toString method, but this method is at the BusinessObjectBase
 level (not the Account level). Not sure exactly where we should be
 extracting the toString method, or what we need to do to fix this particular
 issue.

 We are using ojb-1.0.3 with Spring 1.1.5

If you have a specific proxy interface, then you should specify it
instead of the 'dynamic' value (which is reserved for when the type
that the class-descriptor references, is an interface itself, or if
you use CGLib-proxies). See here for details:

http://db.apache.org/ojb/docu/guides/basic-technique.html#Using+Proxy+Classes

Tom

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



Re: changing OJB's log4j appender

2005-10-17 Thread Thomas Dudziak
On 10/17/05, Thad Welch [EMAIL PROTECTED] wrote:

 i'm trying to change OJB's log4j appender from the console to a file.
 so i edited log4j.properties and replace:

 log4j.appender.A1=org.apache.log4j.ConsoleAppender

 with

 log4j.appender.A1=org.apache.log4j.RollingFileAppender
 log4j.appender.A1.MaxFileSize=100MB
 log4j.appender.A1.File=${catalina.home}/logs/myapp-OJB.log

 unfortunately, the logging still goes to the console. has anyone
 successfully accomplished this.

Are you sure that log4j is actually used to do the logging ? Have a
look into ojb-logging.properties or ojb.properties, there somewhere it
is specified which logger is used.

Tom

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



Re: Torque, Turbine XML format

2005-10-16 Thread Thomas Dudziak
On 10/16/05, Hale India [EMAIL PROTECTED] wrote:

 I am looking to know if unique constraints are managed
 when reverse ingeneering from database using Jdbc.

 In torque dtd unique and unique-column tags exists so
 table creation is made using them, but what's happen
 is we  generate torque from a database (using ddlutils
 for example).

I'm not sure if DdlUtils is able to read them back yet. But you could
check for yourself, and if not, then please open an issue with
DdlUtils' JIRA.

Tom

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



Re: impossibly long insert time for one object

2005-10-12 Thread Thomas Dudziak
On 10/12/05, Charles Harvey III [EMAIL PROTECTED] wrote:
 Hello.
 My application is taking years to insert an object and I can't figure
 out why for the life of me.  For starters, my test DB is in a different
 location than my dev box, so there is a lag time, and I am ok with that.
 But for one specific object the lag time is huge.  It is slightly faster
 when I put the app in production because of the proximity to the database.

Have you considered using a profiler for this (eclipse profiler,
YourKit, JProfiler, ...) ? Eg. set two breakpoints immediately before
and after the insert operation, and then let the profiler run between
these breakpoints. This will give you a detailed analysis of where the
most time is spent. Eg. if you have a network problem, then a lot of
time will be spent in a Socket method.

Tom

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



Re: Repository*.xml validation

2005-10-06 Thread Thomas Dudziak
On 10/6/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I'm sorry I wasn't clear.  The repository.dtd that comes with
 db-ojb-1.0.3 contains this definition:

 !ATTLIST descriptor-repository
 version (1.0) #REQUIRED
 isolation-level (read-uncommitted | read-committed |
 repeatable-read |
  serializable | optimistic | none)
 read-uncommitted
 proxy-prefetching-limit CDATA 50
 

 but when XMLSpy/ME tries to validate this line in repository.xml:

 descriptor-repository version=1.0
 isolation-level=read-uncommitted
 proxy-prefetching-limit=50

 the resulting message is:

 This file is not valid: Default value  must be one of the name tokens
 declared for enumerated attribute 'isolation-level'.

 If I change the dtd definition to

 !ATTLIST descriptor-repository
 version (1.0) #REQUIRED
 isolation-level (read-uncommitted | read-committed |
 repeatable-read |
  serializable | optimistic | none) #IMPLIED
 proxy-prefetching-limit CDATA 50
 

 I get the exactly the same error message.

Yes, because IMO the problem lies in the ATTLIST of class-descriptor,
not descriptor-repository, and therefore you'd have to change this
attribute there.

Tom

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



Re: query error

2005-10-04 Thread Thomas Dudziak
On 10/4/05, David Forslund [EMAIL PROTECTED] wrote:
 I get the following error when trying to access a field of an element of
 a list:

 [PersistentField] ERROR: while set field:
 [try to set 'object value' in 'target object'
 target obj class: gov.lanl.PidServer.PTrait_
 target field name: values
 target field type: class java.util.ArrayList
 target field declared in: gov.lanl.PidServer.PTrait_
 object value class:
 org.apache.ojb.broker.util.collections.RemovalAwareCollection
 object value: [EMAIL PROTECTED]
 ]
 org.apache.ojb.broker.metadata.MetadataException: IllegalAccess error
 setting field:values in object:gov.lanl.PidServer.PTrait_
 2005-10-03 22:45:20,189 [Thread-2] ERROR
 gov.lanl.Database.OJBDatabaseMgr  - retrieveElements: ';' filter:
 '[state = 1, [[[values.value LIKE Forslund%, [values.name = XPN.0]],
 [values.value LIKE David%, [values.name = XPN.1]], [values.value LIKE
 W.%, [values.name = XPN.2]], [values.value LIKE Dr.%, [values.name =
 XPN.3]]], [[values.value LIKE Los Alamos National Lab%, [values.name =
 XAD.0]], [values.value LIKE Los Alamos%, [values.name = XAD.2]],
 [values.value LIKE NM%, [values.name = XAD.3]], [values.value LIKE
 87544%, [values.name = XAD.4]], [values.value LIKE US%, [values.name =
 XAD.5]]], [[values.value LIKE 01%, [values.name = XTN.0]], [values.value
 LIKE 505-555-1212%, [values.name = XTN.1]]], [[values.value LIKE
 1012011234%, [values.name = ST.0]]], [[values.value LIKE 194402018%,
 [values.name = TS.0]]], [value LIKE file:///d:/Java/netforge/dwf.gif%,
 [name = vCard/PHOTO', error:
 org.apache.ojb.broker.PersistenceBrokerException:
 org.apache.ojb.broker.metadata.MetadataException: IllegalAccess error
 setting field:values in object:gov.lanl.PidServer.PTrait_
 at
 org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImplNew.setValueFor(Unknown
 Source)
 at
 org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImplNew.set(Unknown
 Source)
 at
 org.apache.ojb.broker.accesslayer.CollectionPrefetcher.associateBatched(Unknown
 Source)
 at
 org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(Unknown
 Source)
 at
 org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknown
 Source)
 at
 org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
 Source)
 at
 org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
 Source)
 at
 org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
 Source)
 at
 org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
 Source)
 at
 org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
 Source)
 at
 org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
 Source)
 at
 gov.lanl.Database.OJBDatabaseMgr.retrieveElements(OJBDatabaseMgr.java:413)

 PTrait_ has a private ArrayList called values.  It contains NameValue_
 elements which have public accessible String fields (also with get/sets)
 name and value
 There are gets/sets for the Values ArrayList in PTrait_.   PTrait_
 extends an abstract class which (partially) implements the Trait_
 interface.

 I can't tell why I can't access the values in PTrait_.  What I'm doing
 seems consistent with one of the examples in QueryTest except for the
 inheritance aspect.  Any suggestions?

The IllegalAccess error suggests that you're running in an environment
with a SecurityManager enabled that prevents your code from accessing
private fields, eg. an application server. You can either grant your
application that right (see the security manager documentation).
Or you can direct OJB to make the field accessible first before using
it by changing the used PersistentField implementation in
OJB.properties to PersistentFieldPrivilegedImpl.
Or - if the field in question has accessors - use bean access instead
by changing it to PersistentFieldIntrospectorImpl or to
PersistentFieldAutoProxyImpl (which uses bean access or direct
(privileged) access depending on what's available).

Tom

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



Re: ojb-blank.jar

2005-10-04 Thread Thomas Dudziak
On 10/4/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 I have a different problem maybe you can help me with.  I setup
 everything to work with a MySQL database like the example and it chokes
 in the setup-db phase because the project-schema.xml file is incomplete:


 ?xml version=1.0 encoding=ISO-8859-1 standalone=no?
 !DOCTYPE database SYSTEM
 http://db.apache.org/torque/dtd/database_3_0_1.dtd;
 !-- Generated by the xdoclet-ojb module --

 database name=productmanager
 /database

 This is my build.properties file:

 jcdAlias=default
 databaseName=productmanager
 databaseUser=steve
 databasePassword=secret

 dbmsName=MySQL
 jdbcLevel=3.0
 jdbcRuntimeDriver=com.mysql.jdbc.Driver
 urlProtocol=jdbc
 urlSubprotocol=mysql
 urlDbalias=//localhost/${databaseName}

 torque.database=mysql

 torque.database.createUrl=${urlProtocol}:${urlSubprotocol}://localhost/

 jar.name=productmanager.jar

 source.dir=src
 source.java.dir=${source.dir}/java
 source.resource.dir=${source.dir}/resources
 source.test.dir=${source.dir}/test
 source.schema.dir=${source.dir}/schema

 build.dir=build
 lib.dir=lib
 build.classes.dir=${build.dir}/classes/
 build.resource.dir=${build.dir}/resources

 target.dir=target

 I don't know enough about Torque to guess where to look...

Please direct your questions to the user list, not to us developers
directly. This will give you the benefit that more people may be able
to help you, and that others may benefit from the answers.

As for your problem, it seems that the XDoclet didn't process your
Java source. This is usually because you have an error in the Ant
usage, so please post how you use the XDoclet module in your build
file.

Tom

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



Re: ojb-blank.jar

2005-10-04 Thread Thomas Dudziak
On 10/4/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Please direct your questions to the user list, not to us
  developers directly. This will give you the benefit that more
  people may be able to help you, and that others may benefit
  from the answers.

 Trust me, if I could figure out how, I would.  So far I've been
 able to subscribe to the list, but all that lets me do is get
 hundreds of files with extension .ezm.

I think this is a problem of your mail client. You could try a web
mailer (eg. yahoo or similar) or something like Thunderbird.

 On this page
 http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]
 ache.org

 the 'By thread' link gives me a VelocityServlet error, searching
 'ojb-blank.jar' yields nothing, I'm not going to page through 1622
 pages of authors to find you, I found it 'By date'.  Now, how do
 I post a reply?

The offical archives are now at:

http://mail-archives.apache.org/mod_mbox/db-ojb-user/

You can also the archive here (which is also searchable):

http://marc.theaimsgroup.com/?l=ojb-userr=1w=2

Tom

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



Re: null date fields

2005-10-03 Thread Thomas Dudziak
On 10/3/05, Pedro Emanuel Castro Faria Salgado [EMAIL PROTECTED] wrote:

 After storing an object with a date property with a null value, I always
 retrieve the object with a non-null value on that property (in fact it comes
 with the time when the object was stored) when it should be null.

 I tried using the nullable attribute but I am not getting the expected
 behaviour.

 Is there a way to have to solve this?

 The field looks like this:

 field-descriptor
 name=dateApproval
 column=date_approval
 jdbc-type=TIMESTAMP
 nullable=true
 

 I am using OJB 1.0.1 and MySQL.

Which MySQL version do you use ? You should be aware that MySQL prior
to 4.1 automatically updates TIMESTAMP columns, and later versions may
do that as well depending on the server setup (see section 11.3.1.1 in
the MySQL Reference Manual).

I think you should rather use DATETIME as the column field, will save
you some headache.

Tom

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



Re: Query by Example

2005-10-03 Thread Thomas Dudziak
On 10/3/05, David Forslund [EMAIL PROTECTED] wrote:
 This example seems to be in the CVS version of QueryTest but not in
 version 1.0.3.   Can I assume, though, that it works even though there
 is no test for it in 1.0.3?

Seems that in the 1.0.x branch, the only test using QueryByExample is
the MetadataMultithreadedTest, though you can also check the tutorial
for the PB-Api (http://db.apache.org/ojb/docu/tutorials/pb-tutorial.html).

Tom

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



Re: One db-ojb-1.0.3.jar for several WebApps?

2005-09-29 Thread Thomas Dudziak
On 9/29/05, Hiller, Frank RD-AS2 [EMAIL PROTECTED] wrote:

 I'm using OJB 1.0.3. and Tomcat 5.0.28.
 OJB lib is in ..\webapps\MyApp\WEB-INF\lib.

 Where would I have to place db-ojb-1.0.3.jar if I would like to use it
 from several webapps?
 Tomcat\common\lib?
 Tomcat\shared\lib?

 Somewhere else?

You shouldn't do this because it might lead to classloader problems
(because Tomcat uses a different classloader for its global
directories). This is known to happen especially with commons-logging.

Tom

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



Re: Turbine XML format

2005-09-27 Thread Thomas Dudziak
On 9/27/05, Hale India [EMAIL PROTECTED] wrote:

 I will try for Jira, but I don't know how to use
 it

It's not difficult, simply go to

http://issues.apache.org/jira/

there register for a new account for you (the account is for all
Apache projects that use JIRA as their bugtracking system, eg. OJB and
DdlUtils). After that, login and select Create new issue and then
enter the feature request or bug report details.

Tom

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



Re: Turbine XML format

2005-09-26 Thread Thomas Dudziak
On 9/26/05, Hale India [EMAIL PROTECTED] wrote:

 I am using Ojb from some time and would like to find
 out Turbine XML format definition.

 I have been looking at Turbine site, torque site etc.

You can find the DTDs here:

http://db.apache.org/torque/dtd/

the DTD currently used by DdlUtils would be the 3.1 version:

http://db.apache.org/torque/dtd/database_3_1.dtd

(not that there are much differences to the 3.2 version)

 I am trying to get it because I would like to create
 our database using ddlutils and I would like to find
 if it is possible to use COMMENT and or REMARK in
 database.

Interesting, I didn't know this is possible. How about you create a
feature request for DdlUtils and I add (for databases that support
this) the corresponding COMMENT statements ?

 When I create XML from our database, by now Comment on
 our columns are lost and Index also. (Not primary Keys
 nor Foreign Keys but Index).

The comments are retained where the DTD allows to (description
attributes). But you're right, for foreign keys and indices there is
no description attribute. You could ask the Torque guys for whether
they could add this attribute.

Tom

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



Re: Turbine XML format

2005-09-26 Thread Thomas Dudziak
On 9/26/05, Hale India [EMAIL PROTECTED] wrote:

 index tag and unique tag exists in both dtd but I
 found no index element nor unique element created when
 I have generated XML from our database using
 DatabaseIO().write

You could add a bug to DdlUtils' JIRA. If possible please use the
DumpMetadataTask on the database in question like so:

taskdef name=dumpMetadata
 classname=org.apache.ddlutils.task.DumpMetadataTask
  classpath refid=runtime-classpath/
/taskdef

dumpMetadata outputFile=metadata.xml
  database url=jdbc:postgresql://localhost/visite
driverClassName=org.postgresql.Driver
username=superuser
password=secretPassword/
/dumpMetadata

and attach the output (basically a complete dump of the metadata as
returned by the jdbc driver).

 In fact I just add this in our eclipse db plugin.
 It generate XML from database and create database from
 XML using ddlutils. (it create also mapping and
 objects for Ojb).

 I hope that we will publish this new release soon. So
 any help welcome.

Cool! I'm just in the process of finalizing the 1.0 release of
DdlUtils, by creaing unit tests and updating the doc.

Tom

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



Re: connection problem with ojb and Sql server

2005-09-22 Thread Thomas Dudziak
On 9/22/05, Davide Emanuele Denicolo [EMAIL PROTECTED] wrote:
 Hi at all!
 I have this problem:
 I'm using MS SQL Server 2000 as information repository and ojb with java
 My problem is that when the connection between tomcat and sql server has
 broken or SQL gets down,I receive this message to browser


 org.apache.ojb.broker.PersistenceBrokerSQLException: java.sql.SQLException:
 [Microsoft][SQLServer 2000 Driver for JDBC]Connection reset by peer: socket
 write error

This looks like a timeout problem (though it might also be something different).
You could try to configure the connection timeout (refer to the SQLServer doc).
Or you could try a different jdbc driver, eg. jTDS http://jtds.sourceforge.net/.
One other thing to try is to configure OJB to use a poolable data
source (jndi) instead of the jdbc driver directly.

Tom

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



Advice needed: conf of cache locking in non-clustered webapp with Spring PB-Api

2005-09-22 Thread Thomas Dudziak
Hi folks,

has anybody some advice as to how to best configure Spring  OJB
(1.0.3) with regard to caching and locking ?
My thoughts were to use either the 2-level or the oscache impl, and
use pessimistic read-committed locking (how to do that with spring
transactions and the PB-Api ?)

ideas, comments, hints ?

regards,
Tom

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



Re: ojb-blank.jar

2005-09-22 Thread Thomas Dudziak
On 9/22/05, Thomas Franke [EMAIL PROTECTED] wrote:

 I downloaded the ojb-blank.jar from
 'http://mirrorspace.org/apache/db/ojb/db-ojb-1.0.3/'.
 But I'm missing the profile directory with the database profiles in it. I
 thought this is necessary. What does that mean?

Nope, the profiles are actually only required if you adapt your
project from the main OJB dist (which uses the profiles for
configuring against which database to run the test).
Please follow the steps outlined in:

http://db.apache.org/ojb/docu/getting-started.html

Tom

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



Re: Advice needed: conf of cache locking in non-clustered webapp with Spring PB-Api

2005-09-22 Thread Thomas Dudziak
On 9/22/05, Jason McKerr [EMAIL PROTECTED] wrote:

 I wrote the following article which should allow you to use locking and
 2-level caching with Spring and OJB quite easily.  My implementation is
 simple, but you should be able to change it to use whatever you want.

 http://staff.osuosl.org/~mckerrj/?p=8

thanks, but my question was aimed rather for a discussion what would
be best suited and how to use locking effectively in a spring-managed
environment. FYI, I currently use the high-low sequence manager and
the two-level cache impl.

regards,
Tom

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



Re: Foreign keys inability to control CREATE TABLE order cause errors MySQL

2005-09-21 Thread Thomas Dudziak
On 9/21/05, Alex Epshteyn [EMAIL PROTECTED] wrote:
 MySQL gives me an error when Torque attempts to execute my generated
 .sql file.  This happens because the a CREATE TABLE statement has a
 foreign key pointing to a table that hasn't been created yet.
 
 There are two possible ways I can think of to resolve this problem,
 but don't know how to implement them in the XDoclet/Torque framework.
 Perhaps someone could help.
 
 1.  Insert SET FOREIGN_KEY_CHECKS = 0; at the beginning of and SET
 FOREIGN_KEY_CHECKS = 1; at the end of the project-schema.sql file.
 Is there any way to get Torque to do this when it generates that file?
 
 2.  Control the order in which XDoclet generates the table
 descriptions in the project-schema.xml file.  As far as I know there
 is no way of doing this.  Is there?
 
 All other solutions I can think of would be hacks.

There is a third solution. MySQL (as every other database that I know)
is able to add foreign keys via ALTER TABLE statements. Eg. first all
tables are created, and then they are altered to add the foreign keys.
You could try DdlUtils (http://db.apache.org/ddlutils) which does
exactly this and is compatible to the Torque schema XML.

Tom

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



Re: Foreign keys inability to control CREATE TABLE order cause errors MySQL

2005-09-21 Thread Thomas Dudziak
The DdlUtils website is slightly out of date (should be fixed this
week), here's how you'd use it in your Ant build file (with PostgreSQL
in this example, but it is similar with MySQL):

taskdef name=ddlToDatabase
classname=org.apache.ddlutils.task.DdlToDatabaseTask
 classpath refid=runtime-classpath/
   /taskdef

   ddlToDatabase
 database url=jdbc:postgresql://localhost/test
   driverClassName=org.postgresql.Driver
   username=admin
   password=superDuperPassword/
 fileset dir=${build.database.dir} includes=*-schema.xml/

 createdatabase failonerror=false/
 writeschematodatabase alterdatabase=false/
   /ddlToDatabase

Tom

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



Re: Weird BOOT issue

2005-09-21 Thread Thomas Dudziak
On 9/21/05, Bob Damato [EMAIL PROTECTED] wrote:

 I've actually been able to get OJB completely up and running in the portal. I 
 had to hack the OJB source though to do so. In
 org/apache/ojb/broker/metadata/RepositoryPersistor.java, I hardcoded the 
 SAXParserFactory to be an instance of
 com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl();
 Any thoughts on making this configurable through OJB.properties?

I wouldn't like that actually because it is not a problem of OJB but
rather one of the app server.
Have you checked the SDN threads about inqmyxml:

https://forums.sdn.sap.com/thread.jspa?threadID=22479
https://forums.sdn.sap.com/thread.jspa?threadID=24988

You can give OJB a different custom classloader via
org.apache.ojb.broker.util.ClassHelper#setClassLoader, so perhaps that
is the best way to do so (and does not require any OJB hacking) ?

regards,
Tom

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



Re: on delete cascade

2005-09-15 Thread Thomas Dudziak
On 9/15/05, Maksimenko Alexander [EMAIL PROTECTED] wrote:
 Hi All!
 I specify auto-delete=true in my collection descriptor
 
 /**
  * @ojb.collection
 element-class-ref=com.esaya.webmail.datamodel.folder.mail.EmailMessage
 foreignkey=mailFolderId
  * database-foreignkey=false proxy=true
 collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList
  * auto-delete=true auto-update=false proxy=true
  */
 private List content;
 
 and generate database schema using Xdoclet
 
 ojbdoclet destdir=${torque.output.dir} checks=basic
 fileset dir=${outputDatabaseOjbJava}/
 ojbrepository
 destinationFile=OJB-repository-types.xml verbose=true/
 torqueschema databaseName=${pom.groupId}
 destinationFile=${torque.project}-schema.xml/
 /ojbdoclet
 
 but got the following
 
 foreign-key foreignTable=FOLDER
 reference local=MAIL_FOLDER_ID foreign=ID/
 /foreign-key
 
 so attribute onDelete=cascade isn't genereted or I miss something
 can somebody help?

The auto-delete=true setting is processed by OJB, not the database,
therefore there is no corresponding setting in the schema XML.

Tom

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



Re: Pb with Interface

2005-09-15 Thread Thomas Dudziak
On 9/15/05, Gru Samuel [EMAIL PROTECTED] wrote:
 Hi,
 
 Now i use the 1.0.3 version (the pb with ArrayIndexOutOfBoundsException is
 resolved). :-)
 
 I don't know how to describe in descriptors my classes diagram following :
 
 Interface Taille
 {
  int get_LargeurColonne();
 
 }
 Class TailleStructure implements Taille
 {
 int _LargeurColonne;
 public int get_LargeurColonne(){...}
 public void set_LargeurColonne(int att){...}
 }
 
 Class Document
 {
 Taille  _TailleCommandee;
  .
 public
 public Taille get_TailleCommandee(){...}
 public void set_TailleCommandee(Taille newTaille){...}
 }
 
 
 Class Maquette extends Document
 {
 BigDecimal _Numero;
 public Maquette()
 {
  _TailleCommandee = new TailleStructure ();
 }
 
 }
 
 All information for the maquette class (_Numero, _TailleCommandee, ...) is
 in the 'maquette' table of the database.
 my descriptor for these classes is :
 class-descriptor class='Maquette' table='maquette'
   field-descriptor name=_Numero column=numero jdbc-type=numeric
 primarykey=true access=readonly autoincrement=true/
.
!-- taille --
field-descriptor name=_TailleCommandee::_LargeurColonne
 column=nb_largeurcolcommandee jdbc-type=INTEGER/
 /class-descriptor
 
 But when i  do that, i have this exception (i use
 PersistentFieldIntrospectorImplNew class) but i don't undestand because i
 have this method (set_TailleCommandee):
 org.apache.ojb.broker.metadata.MetadataException: Can't get WriteMethod for
 property:_LargeurColonne in
 object:fr.ouestfrance.sip.cezan.structure.taille.TailleStructure
 at
 org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImplNe
 w.setValueFor(Unknown Source)
 at
 org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImplNe
 w.set(Unknown Source)
 at
 org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.buildOrRefreshObject(
 Unknown Source)
 
 Where is the problem ?

I'm not sure whether '_' is allowed as the first character for
property names. It would be easiest if you name the getter and setter
methods following the standard Java conventions, eg. like this:

Interface Taille
{
 int getLargeurColonne();

}
Class TailleStructure implements Taille
{
int _LargeurColonne;
public int getLargeurColonne(){...}
public void setLargeurColonne(int att){...}
}

Class Document
{
   Taille  _TailleCommandee;
.
   public
   public Taille getTailleCommandee(){...}
   public void setTailleCommandee(Taille newTaille){...}
}


Class Maquette extends Document
{
   BigDecimal _Numero;
   public Maquette()
   {
_TailleCommandee = new TailleStructure ();
   }
   
}


and in the repository xml you then simply specify


class-descriptor class='Maquette' table='maquette'
 field-descriptor name=numero column=numero jdbc-type=numeric
primarykey=true access=readonly autoincrement=true/
  .
  !-- taille --
  field-descriptor name=tailleCommandee::largeurColonne
column=nb_largeurcolcommandee jdbc-type=INTEGER/
/class-descriptor

(notice the missing '_' and that the first letter is lowercase)
This way you'll avoid problems with Java's introspection.

Tom

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



Re: on delete cascade

2005-09-15 Thread Thomas Dudziak
On 9/15/05, Maksimenko Alexander [EMAIL PROTECTED] wrote:
 as I can understand torque generator support ondelte attribute in constraint
 so you need only add this attribute in generated by OJB-Doclet
 torque-schema.xml
 or am I miss something ?

Please create a JIRA issue for this, I'll have a look into it.

Tom

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



Re: Pb with Interface

2005-09-15 Thread Thomas Dudziak
On 9/15/05, Gru Samuel [EMAIL PROTECTED] wrote:
 I don't think it is the solution.
 Because i have other classes (with descriptors) with '_' as the first
 character and it works
 For me, it is a  problem of Interface !
 I think the PersistentFieldIntrospectorImplNew class find the setter method
 on the Interface class but not on the intentiated class (in my case
 'TailleStructure' class)

Here is some general information about using OJB with interfaces:

http://db.apache.org/ojb/docu/guides/advanced-technique.html#Using+interfaces+with+OJB

If that doesn't help, then please post the relevant parts of your repository.xml

Tom

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



Re: [junk] Re: Boolean2IntFieldConversion with TINYINT

2005-09-07 Thread Thomas Dudziak
On 9/7/05, Daniel Perry [EMAIL PROTECTED] wrote:
 What i mean, is that you cant do:
 
 field-descriptor
 name=deleted
 column=deleted
 jdbc-type=TINYINT
 conversion=org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldCo
 nversion/
 
 It would make sense to use tinyint for booleans as they only really need
 1bit!
 
 Problem is... i am using xdoclet to make the repository and torque to make
 the database.  So, i have to use INTEGER in the xdoclet comment, so it ends
 up as integer in the database.  I previously have put it as INTEGER then
 used tinyint in mysql - but with xdoclet, everything is automated.

What is the problem with this declaration ? Does XDoclet complain (it
shouldn't) or does the JDBC driver complain or Torque ? Could you post
the error and the generated SQL ?

Btw, you could also try to use BIT as the datatype, it's meant to be
used for boolean columns.

Tom

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



Re: Boolean2IntFieldConversion with TINYINT

2005-09-07 Thread Thomas Dudziak
On 9/7/05, Daniel Perry [EMAIL PROTECTED] wrote:

 The following works fine:
 
 /**
  * @ojb.field jdbc-type=INTEGER
  *
 conversion=org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldCo
 nversion
  */
 protected boolean deleted;
 
 But, if you use:
 
 @ojb.field jdbc-type=TINYINT
 
 Then, xdoclet does as it should:
 
 field-descriptor
 name=deleted
 column=deleted
 jdbc-type=TINYINT
 conversion=org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldCo
 nversion
 
 
 And ojb dies (although i am kinda sympathetic as it is using Boolean2Int,
 not Boolean2Tinyint!):
 
 [PersistentField] ERROR: while set field:
 [try to set 'object value' in 'target object'
 target obj class: com.netcase.pol.bo.User
 target field name: deleted
 target field type: boolean
 target field declared in: com.netcase.pol.bo.BaseBO
 object value class: java.lang.Byte
 object value: 0
 ]
 
 ...
 
 Caused by: java.lang.IllegalArgumentException
 at
 sun.reflect.UnsafeBooleanFieldAccessorImpl.set(UnsafeBooleanFieldAccessorImp
 l.java:68)
 at java.lang.reflect.Field.set(Field.java:656)
 at
 org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImplNe
 w.setValueFor(PersistentFieldDirectAccessImplNew.java:213)


Ah, ok, now it is clear. This has nothing to do with XDoclet at all,
rather the conversion that you specified, is wrong because it converts
between boolean/java.lang.Boolean and int/java.lang.Integer. The
problem arises because the JDBC driver returns a java.lang.Byte object
for the TINYINT column and not an java.lang.Integer object that the
conversion expects.
Therefore you'll have to either use BIT as the JDBC column type or
write your own Boolean2Byte conversion (simply copy the code of the
Boolean2Int conversion and replace Integer with Byte).

Tom

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



Re: Boolean2IntFieldConversion with TINYINT

2005-09-07 Thread Thomas Dudziak
On 9/7/05, Daniel Perry [EMAIL PROTECTED] wrote:

 Hmm... What about modifying Boolean2IntFeild itself so it handles both:

snip

Yes, this would be possible but the instanceof's have a possibly
significant runtime cost, esp. since you would want to also handle
Short, Long and possibly Character as well.

Tom

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



  1   2   3   4   5   6   7   >