Rick,
Thanks for the response. The findByParent in my case refers to itself. My
table (called "treeview") structure is as follows:
cust_id - primary key feild 1 indicates the customer
node_id - primary key feild 2 indicates the unique node id within this
customer
parent_id - (cust_id, parent_id) points back to the parent node (within this
customer) for this row's node_id
sibling_order - order placement of this node within this node's parent's
children
In order to get all nodes that have the same parent (ie the paren's
children) in the right order, I would use the SQL: "SELECT * FROM treeview
WHERE cust_id = :custId AND parent_id = :parentId ORDER BY sibling_order
ASC".
Therefore, I believe my findByParent requires the method signature:
Enumeration findByParent(int custId, int parentId);
What I'm asking here is, what should go between the <query></query> tags of
the jaws.xml file to get the automatic finders working? I tried the
following as my best guess but got SQLExceptions.
<finder>
<name>findByParent</name>
<query>cust_id = ? AND parent_id = ?</query>
<order>sibling_order ASC</order>
</finder>
I am currently getting the following output when I call the findByParent:
[JAWS] java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]COUNT field
incorrect
[JAWS] at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
Is there a way to see the sql output?
I apologize if I misunderstood your post, but I wasn't sure what you meant
about the Parent pointing to another entity. In my case, parent points to
another instance of the same entity.
Thanks agains,
Bill Pfeiffer
Arbitration Forums, Inc
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Rickard �berg
Sent: Friday, June 30, 2000 4:07 AM
To: jBoss
Subject: Re: [jBoss-User] Jaws xml for finder methods
Hi!
Bill Pfeiffer wrote:
> Can someone explain the jaws.xml settings necessary to deploy a finder
> method. In my case, my finder is:
>
> Enumeration findByParent(int custId, int parentId);
>
> my actual where clause would be (cust_id = :custId AND parent_id =
> :parentId)
In this case you could use the automatic finders. I.e, if you have a CMP
field "Parent" pointing to another Entity which has a primary key with
cust_id and parent_id, then you can add the finder
"findByParent(SomeEntity x)" and JAWS will implement this by finding all
entities whose Parent is x.
> What format is the jaws.xml expecting for such a finder in its query tag?
> While I'm asking, what format does the order tag take if you want to sort
by
> more than one column?
Same as SQL, i.e. comma-separated list.
/Rickard
--
Rickard �berg
@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]