[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5810) Database MYSQL supports recursive but populate doesn't work

Raul Romanillos Llorente (JIRA) noreply at atlassian.com
Fri Jan 28 03:37:05 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=39781#action_39781 ] 

Raul Romanillos Llorente commented on HHH-5810:
-----------------------------------------------

After searching I found something similar but is for another Database SQL Server 2005.

Implement support for native recursive query functionality of popular DBMSes
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4030


This solution is not valid because I use Database MYSQL.

Please, can help solve the problem?



Thanks





> Database MYSQL supports recursive but populate doesn't work
> -----------------------------------------------------------
>
>                 Key: HHH-5810
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5810
>             Project: Hibernate Core
>          Issue Type: Task
>          Components: query-sql
>    Affects Versions: 3.3.0.GA
>         Environment: Hibernate 3.3.0 GA, MySQL 5.1.41
>            Reporter: Raul Romanillos Llorente
>
> After running on the screen we see that the field_3 field_1 fields have the same value.
> Hibernate has the same value assigned to the fields valueField_1, valueField_2 and valueField_3 and the database are different values.
> Hibernate did not return good results with createSQLQuery (query).
> ...
> String query = "SELECT i.id_route, i.route_name, ii.route_name, iii.route_name,";
> query += " FROM routes i";
> query += " LEFT JOIN  routes ii ON i.id_route_parent=i.id_route";
> query += " LEFT JOIN  routes iii ON ii.id_route_parent=iii.id_route
> tx = session.getTransaction();
> tx.begin();
> result = session.createSQLQuery(query).list();
> tx.commit();";
> String valueField_0, valueField_1, valueField_2, valueField_3;
> if (result!=null) {
>    for (Object obj: result) {
>       Object [] cols= (Object []) irObj;
>       valueField_0=(cols[0]!=null?cols[0].toString():"");
>       valueField_1=(cols[1]!=null?cols[1].toString():"");
>       valueField_2=(cols[2]!=null?cols[2].toString():"");
>       valueField_3=(cols[3]!=null?cols[3].toString():"");
>       System.out.println("field_1:"+valueField_1+"\nfield_2:"+valueField_2+"\nfield_3:"+valueField_3);
>    }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list