How to get rid of Hibernate and use database by JDBC-driver

5 posts, 0 answers
  1. ILYA
    ILYA avatar
    9 posts
    Member since:
    Jan 2019

    Posted 27 Mar 2019 Link to this post

    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

  2. ILYA
    ILYA avatar
    9 posts
    Member since:
    Jan 2019

    Posted 27 Mar 2019 in reply to ILYA Link to this post

    Sorry, csreenshort is attached
  3. ILYA
    ILYA avatar
    9 posts
    Member since:
    Jan 2019

    Posted 29 Mar 2019 Link to this post

    And screenshort of my database (we use postgreSQL), fielt DATA_EXT - is for detecting parents (if null - it is parent)
  4. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2491 posts

    Posted 29 Mar 2019 Link to this post

    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.
  5. ILYA
    ILYA avatar
    9 posts
    Member since:
    Jan 2019

    Posted 02 Apr 2019 in reply to Viktor Tachev Link to this post

    Thank you very much!

    It works!

Back to Top