List of usage examples for java.sql ResultSet getBoolean
boolean getBoolean(String columnLabel) throws SQLException;
ResultSet
object as a boolean
in the Java programming language. From source file:data.services.ParseBaseService.java
private void updateOptionGroups() throws SQLException, ClassNotFoundException, Exception { List<CarCompletionGroup> ccgList = CCGDao.getAllAsc(); List<CarCompletionGroup> ccgsForSaveList = new ArrayList(); List<CarCompletionGroup> ccgsForUpdateList = new ArrayList(); List<Long> actualQutoIdList = new ArrayList(); HashMap<Long, CarCompletionGroup> ourOldIdCCGMap = new HashMap(); for (CarCompletionGroup ccg : ccgList) { ourOldIdCCGMap.put(ccg.getOldId(), ccg); }/* w ww .j a v a 2 s . c o m*/ ResultSet resSet = getFromQutoBase(getSelectAll(QUTO_CCG_TABLE)); while (resSet.next()) { Long qutoId = resSet.getLong("id"); actualQutoIdList.add(qutoId); Integer level = resSet.getInt("level"); String title = StringAdapter.getString(resSet.getString("title")).trim(); Long parentId = resSet.getLong("parent_id"); Boolean isHidden = resSet.getBoolean("is_hidden"); Boolean isOptReq = resSet.getBoolean("is_option_require"); Boolean isPublish = resSet.getBoolean("is_publish"); Long sort = resSet.getLong("sort"); CarCompletionGroup ccg = ourOldIdCCGMap.get(qutoId); if (ccg == null) { ccg = new CarCompletionGroup(); ccg.setIsHidden(isHidden); ccg.setIsOptReq(isOptReq); ccg.setIsPublish(isPublish); ccg.setLevel(level); ccg.setOldId(qutoId); ccg.setParentId(parentId); ccg.setSort(sort); ccg.setTitle(title); if (validate(ccg, " ?: quto_id=" + qutoId + "; ")) { ccgsForSaveList.add(ccg); } } else { if (!Objects.equals(ccg.getLevel(), level) || !Objects.equals(ccg.getOldId(), qutoId) || !Objects.equals(ccg.getParentId(), parentId) || !Objects.equals(ccg.getSort(), sort) || !ccg.getTitle().equals(title) || !ccg.isIsHidden().equals(isHidden) || !ccg.isIsOptReq().equals(isOptReq) || !ccg.isIsPublish().equals(isPublish)) { ccg.setIsHidden(isHidden); ccg.setIsOptReq(isOptReq); ccg.setIsPublish(isPublish); ccg.setLevel(level); ccg.setParentId(parentId); ccg.setSort(sort); ccg.setTitle(title); if (validate(ccg, " : quto_id=" + qutoId + "; ")) { ccgsForUpdateList.add(ccg); } } } } int s = 0; int u = 0; int d = 0; for (CarCompletionGroup ccg : ccgsForSaveList) { CCGDao.save(ccg); s++; } for (CarCompletionGroup ccg : ccgsForUpdateList) { CCGDao.update(ccg); u++; } for (Long qutoId : ourOldIdCCGMap.keySet()) { if (!actualQutoIdList.contains(qutoId)) { d++; CCGService.delete(ourOldIdCCGMap.get(qutoId)); } } addError(" : " + s + " ? ?, " + u + " , " + d + " ."); }
From source file:gov.nih.nci.ncicb.cadsr.bulkloader.util.excel.DBExcelUtility.java
private ArrayList getRowData(ResultSet rs, String colnames[], String coltype[]) throws Exception { ArrayList data = new ArrayList(); int numberOfColumns = coltype.length; short col = 0; boolean nodata = true; for (int i = 0; i < numberOfColumns; i++) { String dat = ""; if (coltype[i].equalsIgnoreCase(DataType.TYPE_STRING)) { String cdata = rs.getString(colnames[i]); data.add(cdata);/*from ww w. j ava 2 s. c o m*/ } else if (coltype[i].equalsIgnoreCase(DataType.TYPE_INTEGER)) { Integer idata = new Integer(rs.getInt(colnames[i])); data.add(idata); } else if (coltype[i].equalsIgnoreCase(DataType.TYPE_DOUBLE)) { Double ddata = new Double(rs.getDouble(colnames[i])); data.add(ddata); } else if (coltype[i].equalsIgnoreCase(DataType.TYPE_BOOLEAN)) { Boolean bdata = new Boolean(rs.getBoolean(colnames[i])); data.add(bdata); } else if (coltype[i].equalsIgnoreCase(DataType.TYPE_DATE)) { Date dtval = rs.getDate(colnames[i]); data.add(dtval); } } return data; }
From source file:com.sfs.whichdoctor.dao.ReceiptDAOImpl.java
/** * Load receipt.// w w w . jav a 2s . c o m * * @param rs the rs * @param loadDetails the load details * * @return the receipt bean * * @throws SQLException the SQL exception */ private ReceiptBean loadReceipt(final ResultSet rs, final BuilderBean loadDetails) throws SQLException { ReceiptBean receipt = new ReceiptBean(); receipt.setId(rs.getInt("ReceiptId")); receipt.setGUID(rs.getInt("GUID")); receipt.setAbbreviation(rs.getString("Abbreviation")); receipt.setNumber(rs.getString("ReceiptNo")); receipt.setDescription(rs.getString("Description")); receipt.setProcessType(rs.getString("ProcessType")); receipt.setProcessAbbreviation(rs.getString("ProcessAbbreviation")); receipt.setBatchReference(rs.getInt("BatchReference")); receipt.setBank(rs.getString("Bank")); receipt.setBranch(rs.getString("Branch")); try { receipt.setIssued(rs.getDate("Issued")); } catch (SQLException e) { receipt.setIssued(null); } receipt.setCancelled(rs.getBoolean("Cancelled")); int organisationGUID = rs.getInt("OrganisationId"); int personGUID = rs.getInt("PersonId"); if (personGUID > 0) { receipt.setPerson(loadPerson(rs, personGUID, loadDetails)); } if (organisationGUID > 0) { receipt.setOrganisation(loadOrganisation(rs, organisationGUID, loadDetails)); } receipt.setTypeName(rs.getString("Type")); receipt.setClassName(rs.getString("ReceiptType")); receipt.setTotalValue(rs.getDouble("TotalValue")); receipt.setSecurity(rs.getString("Security")); receipt.setActive(rs.getBoolean("Active")); if (loadDetails.getBoolean("HISTORY")) { try { receipt.setCreatedDate(rs.getTimestamp("CreatedDate")); } catch (SQLException sqe) { dataLogger.debug("Error reading CreatedDate: " + sqe.getMessage()); } receipt.setCreatedBy(rs.getString("CreatedBy")); try { receipt.setModifiedDate(rs.getTimestamp("ModifiedDate")); } catch (SQLException sqe) { dataLogger.debug("Error reading ModifiedDate: " + sqe.getMessage()); } receipt.setModifiedBy(rs.getString("ModifiedBy")); try { receipt.setExportedDate(rs.getTimestamp("ExportedDate")); } catch (SQLException sqe) { dataLogger.debug("Error reading ExportedDate: " + sqe.getMessage()); } receipt.setExportedBy(rs.getString("ExportedBy")); } if (loadDetails.getBoolean("TAGS")) { try { receipt.setTags(this.getTagDAO().load(receipt.getGUID(), loadDetails.getString("USERDN"), true)); } catch (Exception e) { dataLogger.error("Error loading tags for receipt: " + e.getMessage()); } } if (loadDetails.getBoolean("MEMO")) { try { receipt.setMemo(this.getMemoDAO().load(receipt.getGUID(), loadDetails.getBoolean("MEMO_FULL"))); } catch (Exception e) { dataLogger.error("Error loading memos: " + e.getMessage()); } } if (loadDetails.getBoolean("PAYMENT")) { try { receipt.setPayments( this.paymentDAO.load(receipt.getGUID(), loadDetails.getBoolean("PAYMENT_FULL"))); } catch (Exception e) { dataLogger.error("Error loading payment details: " + e.getMessage()); } } if (loadDetails.getBoolean("GROUPS")) { receipt.setGroups(loadGroups(receipt.getGUID())); } if (loadDetails.getBoolean("CREATED")) { UserBean user = new UserBean(); user.setDN(rs.getString("CreatedBy")); user.setPreferredName(rs.getString("CreatedFirstName")); user.setLastName(rs.getString("CreatedLastName")); receipt.setCreatedUser(user); } if (loadDetails.getBoolean("MODIFIED")) { UserBean user = new UserBean(); user.setDN(rs.getString("ModifiedBy")); user.setPreferredName(rs.getString("ModifiedFirstName")); user.setLastName(rs.getString("ModifiedLastName")); receipt.setModifiedUser(user); } if (loadDetails.getBoolean("EXPORTED")) { UserBean user = new UserBean(); user.setDN(rs.getString("ExportedBy")); user.setPreferredName(rs.getString("ExportedFirstName")); user.setLastName(rs.getString("ExportedLastName")); receipt.setExportedUser(user); } return receipt; }
From source file:dk.statsbiblioteket.doms.licensemodule.persistence.LicenseModuleStorage.java
public ArrayList<ConfiguredDomLicenseGroupType> getDomLicenseGroupTypes() throws SQLException { PreparedStatement stmt = null; ArrayList<ConfiguredDomLicenseGroupType> list = new ArrayList<ConfiguredDomLicenseGroupType>(); try {//from www. j a va 2 s. com stmt = connection.prepareStatement(selectDomLicenseGroupTypesQuery); ResultSet rs = stmt.executeQuery(); while (rs.next()) { Long id = rs.getLong(ID_COLUMN); String key = rs.getString(KEY_COLUMN); String value_dk = rs.getString(VALUE_DK_COLUMN); String value_en = rs.getString(VALUE_EN_COLUMN); String description = rs.getString(DESCRIPTION_DK_COLUMN); String description_en = rs.getString(DESCRIPTION_EN_COLUMN); String query = rs.getString(QUERY_COLUMN); boolean mustGroup = rs.getBoolean(MUSTGROUP_COLUMN); ConfiguredDomLicenseGroupType item = new ConfiguredDomLicenseGroupType(id, key, value_dk, value_en, description, description_en, query, mustGroup); list.add(item); } return list; } catch (SQLException e) { log.error("SQL Exception in getDomLicenseGroupTypes():" + e.getMessage()); throw e; } finally { closeStatement(stmt); } }
From source file:org.bytesoft.openjtcc.supports.logger.DbTransactionLoggerImpl.java
private Map<XidImpl, TransactionArchive> loadTransactionSet(Connection connection) { Map<XidImpl, TransactionArchive> metaMap = new HashMap<XidImpl, TransactionArchive>(); PreparedStatement stmt = null; ResultSet rs = null; try {// w w w . j a v a 2s .c om StringBuilder ber = new StringBuilder(); ber.append("select global_tx_id, status, status_trace"); ber.append(", coordinator, created_time "); ber.append("from tcc_transaction "); ber.append("where application = ? and endpoint = ? and deleted = ?"); stmt = connection.prepareStatement(ber.toString()); stmt.setString(1, this.instanceKey.getApplication()); stmt.setString(2, this.instanceKey.getEndpoint()); stmt.setBoolean(3, false); rs = stmt.executeQuery(); while (rs.next()) { String globalTransactionId = rs.getString("global_tx_id"); int state = rs.getInt("status"); int trace = rs.getInt("status_trace"); boolean coordinator = rs.getBoolean("coordinator"); Timestamp createdTime = rs.getTimestamp("created_time"); TransactionContext context = new TransactionContext(); TerminalKey terminalKey = new TerminalKey(); terminalKey.setApplication(this.instanceKey.getApplication()); terminalKey.setEndpoint(this.instanceKey.getEndpoint()); context.setTerminalKey(terminalKey); context.setRecovery(true); context.setCompensable(true); context.setCoordinator(coordinator); byte[] globalBytes = ByteUtils.stringToByteArray(globalTransactionId); XidImpl globalXid = this.xidFactory.createGlobalXid(globalBytes); // context.setGlobalXid(globalXid); context.setCreationXid(globalXid); context.setCurrentXid(globalXid); context.setCreatedTime(createdTime.getTime()); TransactionStatus status = new TransactionStatus(state, trace); TransactionArchive meta = new TransactionArchive(); meta.setTransactionStatus(status); meta.setTransactionContext(context); metaMap.put(globalXid, meta); } } catch (Exception ex) { ex.printStackTrace(); } finally { closeResultSet(rs); closeStatement(stmt); } return metaMap; }
From source file:com.erbjuder.logger.server.rest.util.ResultSetConverter.java
public List<String> toStringList(ResultSet rs) throws Exception { List<String> list = new ArrayList<String>(); try {/* w w w . ja v a 2 s.co m*/ // we will need the column names, this will save the table meta-data like column nmae. java.sql.ResultSetMetaData rsmd = rs.getMetaData(); //loop through the ResultSet while (rs.next()) { //figure out how many columns there are int numColumns = rsmd.getColumnCount(); //each row in the ResultSet will be converted to a JSON Object StringBuilder builder = new StringBuilder(); // loop through all the columns and place them into the JSON Object for (int i = 1; i < numColumns + 1; i++) { String column_name = rsmd.getColumnName(i); if (rsmd.getColumnType(i) == java.sql.Types.ARRAY) { builder.append(rs.getArray(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.BIGINT) { builder.append(rs.getInt(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.BOOLEAN) { builder.append(rs.getBoolean(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.BLOB) { builder.append(rs.getBlob(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.DOUBLE) { builder.append(rs.getDouble(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.FLOAT) { builder.append(rs.getFloat(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.INTEGER) { builder.append(rs.getInt(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.NVARCHAR) { builder.append(rs.getNString(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.VARCHAR) { // temp = rs.getString(column_name); //saving column data to temp variable // temp = ESAPI.encoder().canonicalize(temp); //decoding data to base state // temp = ESAPI.encoder().encodeForHTML(temp); //encoding to be browser safe // obj.put(column_name, temp); //putting data into JSON object // builder.append(rs.getNString(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.TINYINT) { builder.append(rs.getInt(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.SMALLINT) { builder.append(rs.getInt(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.DATE) { builder.append(rs.getDate(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.TIME) { builder.append(rs.getTime(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.TIMESTAMP) { builder.append(rs.getTimestamp(column_name)); } else if (rsmd.getColumnType(i) == java.sql.Types.NUMERIC) { builder.append(rs.getBigDecimal(column_name)); } else { builder.append(rs.getObject(column_name)); } } //end foreach list.add(builder.toString()); } //end while } catch (Exception e) { e.printStackTrace(); } return list; //return String list }
From source file:com.nextep.designer.sqlgen.generic.impl.JDBCCapturer.java
/** * Returns a <code>Collection</code> of the indexes for the specified table * present in the data source pointed to by the connection object provided * by the specified <code>context</code> and notifies the specified * <code>monitor</code> while capturing. * // w w w . j ava 2 s. c om * @param context * a {@link ICaptureContext} to store the captured objects * @param monitor * the {@link IProgressMonitor} to notify while capturing objects * @param table * the {@link IBasicTable} for which foreign keys must be * captured * @return a {@link Collection} of {@link IIndex} objects if the specified * table has indexes, an empty <code>Collection</code> otherwise */ private Collection<IIndex> getTableIndexes(ICaptureContext context, IProgressMonitor monitor, IBasicTable table) { Collection<IIndex> indexes = new ArrayList<IIndex>(); IFormatter formatter = getConnectionVendor(context).getNameFormatter(); final String tableName = table.getName(); try { final DatabaseMetaData md = ((Connection) context.getConnectionObject()).getMetaData(); ResultSet rset = null; if (md != null) { rset = md.getIndexInfo(getObjectOrContextCatalog(context, table), getObjectOrContextSchema(context, table), tableName, false, false); CaptureHelper.updateMonitor(monitor, getCounter(), 1, 1); } if (rset != null) { IIndex currIndex = null; String currIndexName = null; boolean indexIsValid = false; try { while (rset.next()) { final String indexName = rset.getString(COLUMN_NAME_INDEX_NAME); final boolean nonUnique = rset.getBoolean(COLUMN_NAME_NON_UNIQUE); final String indexColumnName = rset.getString(COLUMN_NAME_COLUMN_NAME); final String ascOrDesc = rset.getString(COLUMN_NAME_ASC_OR_DESC); final short indexType = rset.getShort(COLUMN_NAME_TYPE); if (indexName != null && !"".equals(indexName.trim())) { //$NON-NLS-1$ if (LOGGER.isDebugEnabled()) { String logPrefix = "[" + indexName + "]"; //$NON-NLS-1$ //$NON-NLS-2$ LOGGER.debug("= " + logPrefix + " Index Metadata ="); //$NON-NLS-1$ //$NON-NLS-2$ LOGGER.debug(logPrefix + "[" + COLUMN_NAME_INDEX_NAME + "] " //$NON-NLS-1$ //$NON-NLS-2$ + indexName); LOGGER.debug(logPrefix + "[" + COLUMN_NAME_NON_UNIQUE + "] " //$NON-NLS-1$ //$NON-NLS-2$ + nonUnique); LOGGER.debug(logPrefix + "[" + COLUMN_NAME_COLUMN_NAME + "] " //$NON-NLS-1$ //$NON-NLS-2$ + indexColumnName); LOGGER.debug(logPrefix + "[" + COLUMN_NAME_ASC_OR_DESC + "] " //$NON-NLS-1$ //$NON-NLS-2$ + ascOrDesc); LOGGER.debug(logPrefix + "[" + COLUMN_NAME_TYPE + "] " + indexType); //$NON-NLS-1$ //$NON-NLS-2$ } if (null == currIndexName || !currIndexName.equals(indexName) || indexIsValid) { currIndexName = indexName; final String formatIndexName = formatter.format(indexName); final String formatIndexColumnName = formatter.format(indexColumnName); if (null == currIndex || !formatIndexName.equals(currIndex.getIndexName())) { IVersionable<IIndex> v = VersionableFactory.createVersionable(IIndex.class, context.getConnection().getDBVendor()); currIndex = v.getVersionnedObject().getModel(); currIndex.setName(formatIndexName); currIndex.setIndexType( nonUnique ? CaptureHelper.getIndexType(indexType) : IndexType.UNIQUE); indexes.add(currIndex); indexIsValid = true; } final IBasicColumn column = (IBasicColumn) context.getCapturedObject( IElementType.getInstance(IBasicColumn.TYPE_ID), CaptureHelper.getUniqueObjectName(tableName, formatIndexColumnName)); if (column != null) { /* * Columns are ordered by INDEX_NAME, * ORDINAL_POSITION in the returned * ResultSet, so we don't have to specify * the position of the index column when * adding it to the index. */ currIndex.addColumnRef(column.getReference()); } else { LOGGER.warn("Index [" + formatIndexName + "] has been partially captured during import because the referencing column [" + tableName + "[" + formatIndexColumnName //$NON-NLS-1$ + "]] could not be found in the current workspace"); indexIsValid = false; /* * Now the index is invalid, we remove it * from the indexes list that will be * returned to the caller of this method. */ indexes.remove(currIndex); } } } } } finally { CaptureHelper.safeClose(rset, null); } } } catch (SQLException sqle) { LOGGER.error("Unable to fetch indexes for table [" + tableName + "] from " + getConnectionVendorName(context) + " server: " + sqle.getMessage(), sqle); } return indexes; }
From source file:com.krminc.phr.security.PHRRealm.java
/** * Checks the authentication of a user and returns the groups it belongs to. * * @return groups that this particular user belongs to *//*from ww w .j a v a 2 s .c o m*/ public String[] authenticateUser(String user, String password) { String query = "SELECT password, requires_reset, is_locked_out, active, failed_password_attempts FROM user_users WHERE username = ?"; ResultSet rs = null; String passwordHash = new String(); boolean requiresReset = false; boolean lockedOut = false; boolean active = false; int failedAttemptsVal = 0; PreparedStatement st = null; try { createDS(); conn = ds.getNonTxConnection(); st = conn.prepareStatement(query); st.setString(1, user); rs = st.executeQuery(); } catch (Exception e) { log("Error getting password from database"); log(e.getMessage()); rs = null; } finally { try { conn.close(); } catch (Exception e) { log(e.getMessage()); } conn = null; } if (rs != null) { try { if (rs.next()) { passwordHash = rs.getString(1); requiresReset = rs.getBoolean(2); lockedOut = rs.getBoolean(3); active = rs.getBoolean(4); failedAttemptsVal = rs.getInt(5); } } catch (Exception e) { log("Error getting password from resultset"); log(e.getMessage()); } finally { try { st.close(); rs.close(); } catch (Exception e) { log(e.getMessage()); } } } //inactive users have no roles, no login attempt monitoring if (!active) return null; //locked users have a locked role, which is filtered by the Login class as needed if (lockedOut) { incrementFailedUpdate(user); String[] lock = { lockedRole }; return lock; } if (!passwordHash.isEmpty()) { if (passwordHash.equals(DigestUtils.sha512Hex(password))) { //password is correct //find and return groups String[] retArr = null; try { Enumeration userGroups = getGroupNames(user); ArrayList retGroups = new ArrayList(); //populate with groups from db while (userGroups.hasMoreElements()) { retGroups.add(userGroups.nextElement().toString()); } //force password reset if needed by adding role if (requiresReset) { retGroups.add(resetRole); } //formulate returnable collection Object[] arr = retGroups.toArray(); retArr = new String[arr.length]; for (int i = 0; i < arr.length; i++) { retArr[i] = arr[i].toString(); } } catch (NoSuchUserException e) { log("Exception encountered looking up password"); } catch (Exception e) { log("Group lookup error: " + e.getClass() + ":" + e.getMessage()); } //reset bad login info, if needed, now that we're successful // this will only happen for valid logins and pw reset logins, not locks or inactive accts if (failedAttemptsVal > 0) doSuccessfulUpdate(user); return retArr; } else { log("Passwords do not match"); try { InvalidPasswordAttempt(user); } catch (NoSuchUserException e) { //not an issue here } } } else { log("Unable to find user password"); } return null; }
From source file:dk.statsbiblioteket.doms.licensemodule.persistence.H2Storage.java
public ArrayList<ConfiguredDomLicenseGroupType> getDomLicenseGroupTypes() throws SQLException { PreparedStatement stmt = null; ArrayList<ConfiguredDomLicenseGroupType> list = new ArrayList<ConfiguredDomLicenseGroupType>(); try {//from w w w .jav a2 s. c om stmt = singleDBConnection.prepareStatement(selectDomLicenseGroupTypesQuery); ResultSet rs = stmt.executeQuery(); while (rs.next()) { Long id = rs.getLong(ID_COLUMN); String key = rs.getString(KEY_COLUMN); String value_dk = rs.getString(VALUE_DK_COLUMN); String value_en = rs.getString(VALUE_EN_COLUMN); String description = rs.getString(DESCRIPTION_DK_COLUMN); String description_en = rs.getString(DESCRIPTION_EN_COLUMN); String query = rs.getString(QUERY_COLUMN); boolean mustGroup = rs.getBoolean(MUSTGROUP_COLUMN); ConfiguredDomLicenseGroupType item = new ConfiguredDomLicenseGroupType(id, key, value_dk, value_en, description, description_en, query, mustGroup); list.add(item); } return list; } catch (SQLException e) { log.error("SQL Exception in getDomLicenseGroupTypes():" + e.getMessage()); throw e; } finally { closeStatement(stmt); } }
From source file:com.havoc.hotel.admin.dao.impl.BookingDAOImpl.java
@Override public Booking getById(int bookingId) throws SQLException { return (Booking) jdbcTemplate.query(SQLConstant.BOOKING_GETBYID, new Object[] { bookingId }, new ResultSetExtractor<Booking>() { @Override/*www .ja v a2 s .co m*/ public Booking extractData(ResultSet rs) throws SQLException, DataAccessException { Booking b = null; if (rs.next()) { b = new Booking(); b.setBookingId(rs.getInt("booking_id")); b.setFirstName(rs.getString("first_name")); b.setLastName(rs.getString("last_name")); Room r = new Room(); r.setRoomId(rs.getInt("room_id")); r.setRoomPrice(rs.getInt("room_price")); r.setRoomNumber(rs.getInt("room_number")); b.setRoom(r); b.setCheckinDate(rs.getDate("checkin_date")); b.setTotalDays(rs.getInt("total_days")); b.setTotalNights(rs.getInt("total_nights")); b.setCheckoutDate(rs.getDate("checkout_date")); Customer c = new Customer(); c.setCustomerId(rs.getInt("customer_id")); c.setFirstName(rs.getString("first_name")); c.setLastName(rs.getString("last_name")); c.setUsername(rs.getString("username")); b.setCustomer(c); b.setTotalPrice(rs.getInt("total_price")); b.setPdf(rs.getString("pdf")); b.setStatus(rs.getBoolean("status")); } return b; } }); }