javagreendao

Problems with queryBuilder greenDAO


I am using latest version of GreenDAO... I am missing something on using the data from the DB.

I need to prevent the creation of records that have the same PROFILE_NUMBER. Currently during testing I have inserted 1 record with the PROFILE_NUMBER of 1.

I need someone to show me an example of how to obtain the actual value of the field from the db.

I am using this

SvecPoleDao svecPoleDao = daoSession.getSvecPoleDao();
List poles = svecPoleDao.queryBuilder().where(SvecPoleDao.Properties.Profile_number.eq(1)).list();

and it obtains something... this.

[com.example.bobby.poleattachmenttest2_workingdatabase.db.SvecPole@bfe830c3.2]

Is this serialized? The actual value I am looking for here is 1.


Solution

  • Here is the solution.You'll need to use listlazy() instead of list().

    List<SvecPole> poles = svecPoleDao.queryBuilder().where(SvecPoleDao.Properties.Profile_number.eq(1)).listLazy();