This is a migrated thread and some comments may be shown as answers.
How to get rid of Hibernate and use database by JDBC-driver
4 Answers 5 Views
This is a migrated thread and some comments may be shown as answers.
ILYA
Top achievements
Rank 1
ILYA asked on 27 Mar 2019, 05:50 PM

We need to get rid of Hibernate (change it to JDBC-driver).

We use basic usage of TreeList (from springs-demos) and have some problems with uploading our database in TreeList.

Wу think it is because of this fynction:

@Override
public List<TObjectType2> getList() {

Connection connection = cn.getConnection();
List<TObjectType2> result = new ArrayList<TObjectType2>();
try {
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM \"ID_OBJECT_TYPE_2\"");
while (resultSet.next()) {
TObjectType2 to = new TObjectType2();
to.setIdObjectType(resultSet.getString("ID_OBJECT_TYPE"));
to.setDescription(resultSet.getString("DESCRIPTION"));
to.setObject1C(resultSet.getString("OBJECT_1C"));
result.add(to);
}
return result;
} catch (SQLException e) {
e.printStackTrace();
return null;
}
}

 

Because with hibernate it is like this:

@Override
public List<EmployeeDirectory> getList() {
return sessionFactory.getCurrentSession().createCriteria(EmployeeDirectory.class).list();
}

 

In the web it we can see, that there are 5 items (that's true!), but "No records to display"

http://skrinshoter.ru/s/270319/pTQKFDXl

4 Answers, 1 is accepted

Sort by
0
ILYA
Top achievements
Rank 1
answered on 27 Mar 2019, 05:52 PM
Sorry, csreenshort is attached
0
ILYA
Top achievements
Rank 1
answered on 29 Mar 2019, 01:34 PM
And screenshort of my database (we use postgreSQL), fielt DATA_EXT - is for detecting parents (if null - it is parent)
0
Viktor Tachev
Telerik team
answered on 29 Mar 2019, 02:59 PM
Hello Ilya,

The TreeList widget will construct the hierarchy structure using the parentId field. Make sure that the field specifying a parent is defined in the TreeList DataSource configuration. Like in the example below. The parentId field in the demo is reportsTo.


Also, in the provided code it seems that the first method returns List of TObjectType2 and the second returns List of EmployeeDirectory. If the two object have different fields make sure that the TreeList configuration is using the correct field names. 


Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
ILYA
Top achievements
Rank 1
answered on 02 Apr 2019, 02:49 PM

Thank you very much!

It works!

Asked by
ILYA
Top achievements
Rank 1
Answers by
ILYA
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or