Hi,

>> It demonstrates the new SQLQuery interface, which will replace the
>> horrible createSQLQuery() methods.
>
> It for sure looks better.

I also like the look of it.

> List l = s.createSQLQuery("select {org.*}, {emp.*}, emp.regionCode from
> organization org left outer join employment emp on org.id = emp.employer")
>                       .addEntity("org", Organization.class)
>                       .addJoin("emp", "org.employments")
>                       .addScalar("regionCode", Hibernate.STRING)
>                       .list();

Looks okay to me. Shouldn't this be "select {org.*}, {emp.*},
emp.regionCode {regionCode} from ...", or did you remove aliasing for the
scalars?

> addScalar - ok, any thoughts on how this "scales" up to handling
> compositeusertypes ?
>
> The suggested xml version is something like:
> <return-scalar type="MonetaryAmount">
>    <column-alias name="c1"/>
>    <column-alias name="c2"/>
> </return-scalar>
>
> in the API that would be something like:
> .addScalar(new String[] { "c1", "c2" },
> Hibernate.custom(MonetaryAmmount.class)) or ?

Can't we reuse the "names" from the CustomType? Something like "select
ammount {money.ammount}, currency {money.currency} from ..."

> Then there is the whole sequencing of the resulting Object[] ?
> If we want to keep the strict ordering scalar-first, entities-last then I
> would
> like to force the users to obey to this in their code. This could be done
> by
> simply having addScalar check that no entities have been added - and
> otherwise
> throw an exception telling about the sequence needed ?

I would rather go for some user-defined ordering, e.g. the order of the
addXXX() method calls. Enforcing something like "entities always first"
sounds a bit confusing to me, what if I return multiple entities, scalars,
how do I know which one comes first then?

Michael


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to