You can specify a "subquery" by adding query instances to a criteria instance.
However, when the SQL is generated, this subquery would exist in the WHERE clause of the SQL statement correct?
Jakob, what problems were you having with the subqueries in your test?
It would seem that the "subqueries" in the Criteria object would it have nothing to do with the table or source of the columns where a subquery in the FROM clause of an SQL statement would.
SELECT <column> FROM (SELECT * FROM <table>)
vs.
SELECT * FROM <table> WHERE <column> IN (SELECT <column> FROM <table> WHERE <column> = 'aValue')
If so, the table alias would still not be needed because the columns are still only coming from one table....
--bobby
Jakob Braeuchi wrote:
hi bobby,
please have a look at QueryTest there are some test cases using subqueries.
jakob
Bobby Lawrence schrieb:
What subqueries?
I didn't know you could specify a subquery in OJB.
Although, I have been doing it in the repository.xml file instead of a table name....
--bobby
Jakob Braeuchi wrote:
hi antonio, bobby,
i did a quick test using ojb 1.1 and it's not a big issue to get rid of the aliases. the only problem i have are the subqueries.
jakob
Antonio Gallardo schrieb:
On Vie, 21 de Enero de 2005, 12:23, Bobby Lawrence dijo:
Well - it seems that the alias is not needed.
If the class only goes to one table for its data, why does the table
need an alias?
If an alias was not used, you could specify string literals for a column
name.
Yep. But remember that we are auto-generating queries. We will need to
create a more complex logic to decide if a fields needs or not an alias
and IMHO this will take more time than now.
I am not telling this could not be improved. Perhaps we need to make some
test about it.
Best Regards,
Antonio Gallardo.
Jakob Braeuchi wrote:
hi,
ojb should always use the alias in front of the column name. if it does not, it could probably not translate the attribute name into a column name.
btw: what exactly is the problem with the alias ??
jakob
Vesely, Max [IT] schrieb:
Bobby,
I was able to do it by listing field names in a ReportQuery object.
It also won't append table alias in front of the column name in this
case.
Max.
-----Original Message-----
From: Bobby Lawrence [mailto:[EMAIL PROTECTED] Sent: Thursday,
January 20, 2005 5:38 PM
To: [email protected]
Subject: remove table alias in generated SQL?
Is there a way to tell OJB to not use the table alias in front of the
column names when it generates SQL?
Currently, when you specifiy that a class comes from <tableA> and a
field of that class comes from <fieldA>, OJB executes the following
SQL:
SELECT A0.<fieldA> FROM <tableA> A0
If you can't map one class to multiple tables, I don't see why this is necessary. Is there any way around this?
Instead of mapping a field to a specific column, I want to map it to
a string literal so that it always has the same value for the class.
Ex. <field-descriptor column= 'some literal' AS myColumn">
-- Bobby
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- ---------------------------- Bobby Lawrence MIS Application Developer
Jefferson Lab (www.jlab.org)
Email: [EMAIL PROTECTED] Office: (757) 269-5818 Pager: (757) 584-5818 ----------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- ---------------------------- Bobby Lawrence MIS Application Developer
Jefferson Lab (www.jlab.org)
Email: [EMAIL PROTECTED] Office: (757) 269-5818 Pager: (757) 584-5818 ----------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
