Hi everybody,

I am currently working on finishing the support for scalar SQL queries, and I am facing some doubt over how the createSqlQuery() function should work now. The difficulty ist that the Type of the scalar result has to be determined. There are various options:

- Let people pass in the resulting class, e.g. createSqlQuery("...", {"user", "username"}, {User.class, String.class}). Then pass the classname to heuristicType. This sucks, because heuristcType can not guess fitting UserTypes and does not work at all for ParameterizedTypes.

- Let people pass in a mix of Types and Classes by changing the API to accept an Object array, e.g. createSqlQuery("...", {"user", "username"}, {User.class, Hibernate.STRING}). This is also not very nice because it reduces API typesafty and feels generally a bit dirty.

- Change the API to accept a Type[] instead of a Class[], e.g. createSqlQuery("...", {"user", "username"}, {Hibernate.entity(User.class), Hibernate.STRING}). Also sucks because it breaks existing code.

- Offering both 1 and 3 might also be an option, keep old queries working and tell people to use 3 if they want to do scalar queries - leads to API bloat and added confusion.

I am a bit lost, what would you think?

Michael

--
Michael Gloegl          mail:  [EMAIL PROTECTED]
                        www:   http://www.gloegl.de
                        phone: +49 (0)176 24 111 070


------------------------------------------------------- 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