Java: DynaBean.contains (String name, String key) - how to use it correctly?

I am using List to retrieve a ResultSet from an SQL query (using mysql). After I select one row using

DynaBean row = rowList.get(0); 

I would like to know if one of the columns named 'id' exists.

The problem is that a function row.contains()requires two parameters. String nameand String key. I cannot figure out how to use this function.

any ideas?

thank!

+3
source share
1 answer

Welp.. , , get() catch try catching IllegalArgumentException, , .

    List<DynaBean> rowsList=this._mysqlDb.foobar();
    Date timeStamp=null;
    for (int i=0;i<rowsList.size();i++) {
        DynaBean row = rowsList.get(i);
        try {
         timeStamp = this._mysqlDb.sqlTimestampToDate((java.sql.Timestamp)row.get("end_timestamp"));
        } catch (IllegalArgumentException e) {
            log.error("could not find properties: {}",e.getMessage());
            return false;
        }
}
+2

Source: https://habr.com/ru/post/1782426/


All Articles