On Lun, 24 de Enero de 2005, 8:32, Bobby Lawrence dijo: > Not having an alias would allow you to use functions and string literals. > You could specify a string literal in the field-descriptor like this: > > <field-descriptor name="myField" column="' 'a string literal' "> > This would give you the same value for every class instance, which might > not seem that useful at first, but this is exactly what I needed in my > project for a brief time. At the time, I was expecting values from the > database where the field did not exist yet and I needed something to test.
Is posible to test for null? > You could also specify functions in the field-descriptor like this: > <field-descriptor name="wholeName" column="CONCAT(CONCAT(firstname, ' ', > lastname) AS wholename"> > If using an Oracle database, this would concatenate the first and last > names to give you a whole name. Could be used in a ReportQuery if we make it resolve more than 1 field in a expresion. > > Another example on concatenation w/ Oracle without using the function: > <field-descriptor name="wholeName" column="firstname || ' ' || lastname > AS wholename"> Works in PostgreSQL too, again the solution is using a ReportQuery that solves multiplefields in one expresion. > All of these should be possible if OJB didn't use table aliases in its > generated SQL statements. While the theory indicates that each field in the database must have a unique name. In the practice, we found that in some databases, the users choose same names for fields in diferentables. Sample: table1.ID table2.ID the same field name "ID" should be resolved and this is why I think OJB choosed to use SQL table alias to resolve this names. > What IS the benefit of using an alias? Not being a big fan of SQL alias, but what I understand: 1-This is convenient when you want to obtain information from two separate tables (the technical term is 'perform joins'). The advantage of using a table alias when doing joins is readily apparent when we talk about joins. 2- Generate shorter queries: SELECT from mylongnametable.fieldA, mylongnametable.fieldB FROM mylongnametable; vs. SELECT from A0.fieldA, A0.fieldB FROM mylongnametable A0; Hope this helps, Best Regards, Antonio Gallardo. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]