001// -------------------------------------------------------------------------------- 002// Copyright 2002-2026 Echo Three, LLC 003// 004// Licensed under the Apache License, Version 2.0 (the "License"); 005// you may not use this file except in compliance with the License. 006// You may obtain a copy of the License at 007// 008// http://www.apache.org/licenses/LICENSE-2.0 009// 010// Unless required by applicable law or agreed to in writing, software 011// distributed under the License is distributed on an "AS IS" BASIS, 012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013// See the License for the specific language governing permissions and 014// limitations under the License. 015// -------------------------------------------------------------------------------- 016// Generated File -- DO NOT EDIT BY HAND 017// -------------------------------------------------------------------------------- 018 019/** 020 * HarmonizedTariffScheduleCodeDetailFactory.java 021 */ 022 023package com.echothree.model.data.item.server.factory; 024 025import com.echothree.model.data.item.common.pk.HarmonizedTariffScheduleCodePK; 026import com.echothree.model.data.geo.common.pk.GeoCodePK; 027import com.echothree.model.data.item.common.pk.HarmonizedTariffScheduleCodeUnitPK; 028 029import com.echothree.model.data.item.server.entity.HarmonizedTariffScheduleCode; 030import com.echothree.model.data.geo.server.entity.GeoCode; 031import com.echothree.model.data.item.server.entity.HarmonizedTariffScheduleCodeUnit; 032 033import com.echothree.model.data.item.common.HarmonizedTariffScheduleCodeDetailConstants; 034import com.echothree.model.data.item.common.pk.HarmonizedTariffScheduleCodeDetailPK; 035import com.echothree.model.data.item.server.value.HarmonizedTariffScheduleCodeDetailValue; 036import com.echothree.model.data.item.server.entity.HarmonizedTariffScheduleCodeDetail; 037import com.echothree.util.common.exception.PersistenceDatabaseException; 038import com.echothree.util.common.exception.PersistenceDatabaseUpdateException; 039import com.echothree.util.common.exception.PersistenceNotNullException; 040import com.echothree.util.server.persistence.BaseFactory; 041import com.echothree.util.server.persistence.EntityIdGenerator; 042import com.echothree.util.server.persistence.EntityPermission; 043import com.echothree.util.server.persistence.PersistenceDebugFlags; 044import com.echothree.util.server.persistence.Session; 045import java.sql.PreparedStatement; 046import java.sql.ResultSet; 047import java.sql.SQLException; 048import java.sql.Types; 049import java.io.ByteArrayInputStream; 050import java.io.StringReader; 051import java.util.ArrayList; 052import java.util.Collection; 053import java.util.HashSet; 054import java.util.List; 055import java.util.Map; 056import java.util.Set; 057import javax.enterprise.context.ApplicationScoped; 058import javax.enterprise.inject.spi.CDI; 059import javax.inject.Inject; 060import org.jooq.ResultQuery; 061import org.slf4j.Logger; 062import org.slf4j.LoggerFactory; 063 064@ApplicationScoped 065public class HarmonizedTariffScheduleCodeDetailFactory 066 implements BaseFactory<HarmonizedTariffScheduleCodeDetailPK, HarmonizedTariffScheduleCodeDetail> { 067 068 @Inject 069 Session session; 070 071 //private static final Logger log = LoggerFactory.getLogger(HarmonizedTariffScheduleCodeDetailFactory.class); 072 073 final private static String SQL_SELECT_READ_ONLY = "SELECT hztscdt_harmonizedtariffschedulecodedetailid, hztscdt_hztsc_harmonizedtariffschedulecodeid, hztscdt_countrygeocodeid, hztscdt_harmonizedtariffschedulecodename, hztscdt_firstharmonizedtariffschedulecodeunitid, hztscdt_secondharmonizedtariffschedulecodeunitid, hztscdt_isdefault, hztscdt_sortorder, hztscdt_fromtime, hztscdt_thrutime FROM harmonizedtariffschedulecodedetails WHERE hztscdt_harmonizedtariffschedulecodedetailid = ?"; 074 final private static String SQL_SELECT_READ_WRITE = "SELECT hztscdt_harmonizedtariffschedulecodedetailid, hztscdt_hztsc_harmonizedtariffschedulecodeid, hztscdt_countrygeocodeid, hztscdt_harmonizedtariffschedulecodename, hztscdt_firstharmonizedtariffschedulecodeunitid, hztscdt_secondharmonizedtariffschedulecodeunitid, hztscdt_isdefault, hztscdt_sortorder, hztscdt_fromtime, hztscdt_thrutime FROM harmonizedtariffschedulecodedetails WHERE hztscdt_harmonizedtariffschedulecodedetailid = ? FOR UPDATE"; 075 final private static String SQL_INSERT = "INSERT INTO harmonizedtariffschedulecodedetails (hztscdt_harmonizedtariffschedulecodedetailid, hztscdt_hztsc_harmonizedtariffschedulecodeid, hztscdt_countrygeocodeid, hztscdt_harmonizedtariffschedulecodename, hztscdt_firstharmonizedtariffschedulecodeunitid, hztscdt_secondharmonizedtariffschedulecodeunitid, hztscdt_isdefault, hztscdt_sortorder, hztscdt_fromtime, hztscdt_thrutime) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; 076 final private static String SQL_UPDATE = "UPDATE harmonizedtariffschedulecodedetails SET hztscdt_hztsc_harmonizedtariffschedulecodeid = ?, hztscdt_countrygeocodeid = ?, hztscdt_harmonizedtariffschedulecodename = ?, hztscdt_firstharmonizedtariffschedulecodeunitid = ?, hztscdt_secondharmonizedtariffschedulecodeunitid = ?, hztscdt_isdefault = ?, hztscdt_sortorder = ?, hztscdt_fromtime = ?, hztscdt_thrutime = ? WHERE hztscdt_harmonizedtariffschedulecodedetailid = ?"; 077 final private static String SQL_DELETE = "DELETE FROM harmonizedtariffschedulecodedetails WHERE hztscdt_harmonizedtariffschedulecodedetailid = ?"; 078 final private static String SQL_VALID = "SELECT COUNT(*) FROM harmonizedtariffschedulecodedetails WHERE hztscdt_harmonizedtariffschedulecodedetailid = ?"; 079 080 final private static String PK_COLUMN = "hztscdt_harmonizedtariffschedulecodedetailid"; 081 final private static String ALL_COLUMNS = "hztscdt_harmonizedtariffschedulecodedetailid, hztscdt_hztsc_harmonizedtariffschedulecodeid, hztscdt_countrygeocodeid, hztscdt_harmonizedtariffschedulecodename, hztscdt_firstharmonizedtariffschedulecodeunitid, hztscdt_secondharmonizedtariffschedulecodeunitid, hztscdt_isdefault, hztscdt_sortorder, hztscdt_fromtime, hztscdt_thrutime"; 082 final public static String TABLE_NAME = "harmonizedtariffschedulecodedetails"; 083 084 final public static String HZTSCDT_HARMONIZEDTARIFFSCHEDULECODEDETAILID = "hztscdt_harmonizedtariffschedulecodedetailid"; 085 final public static String HZTSCDT_HZTSC_HARMONIZEDTARIFFSCHEDULECODEID = "hztscdt_hztsc_harmonizedtariffschedulecodeid"; 086 final public static String HZTSCDT_COUNTRYGEOCODEID = "hztscdt_countrygeocodeid"; 087 final public static String HZTSCDT_HARMONIZEDTARIFFSCHEDULECODENAME = "hztscdt_harmonizedtariffschedulecodename"; 088 final public static String HZTSCDT_FIRSTHARMONIZEDTARIFFSCHEDULECODEUNITID = "hztscdt_firstharmonizedtariffschedulecodeunitid"; 089 final public static String HZTSCDT_SECONDHARMONIZEDTARIFFSCHEDULECODEUNITID = "hztscdt_secondharmonizedtariffschedulecodeunitid"; 090 final public static String HZTSCDT_ISDEFAULT = "hztscdt_isdefault"; 091 final public static String HZTSCDT_SORTORDER = "hztscdt_sortorder"; 092 final public static String HZTSCDT_FROMTIME = "hztscdt_fromtime"; 093 final public static String HZTSCDT_THRUTIME = "hztscdt_thrutime"; 094 095 final private static EntityIdGenerator entityIdGenerator = new EntityIdGenerator(HarmonizedTariffScheduleCodeDetailConstants.COMPONENT_VENDOR_NAME, HarmonizedTariffScheduleCodeDetailConstants.ENTITY_TYPE_NAME); 096 097 /** Creates a new instance of HarmonizedTariffScheduleCodeDetailFactory */ 098 protected HarmonizedTariffScheduleCodeDetailFactory() { 099 super(); 100 } 101 102 public static HarmonizedTariffScheduleCodeDetailFactory getInstance() { 103 return CDI.current().select(HarmonizedTariffScheduleCodeDetailFactory.class).get(); 104 } 105 106 @Override 107 public String getPKColumn() { 108 return PK_COLUMN; 109 } 110 111 @Override 112 public String getAllColumns() { 113 return ALL_COLUMNS; 114 } 115 116 @Override 117 public String getTableName() { 118 return TABLE_NAME; 119 } 120 121 @Override 122 public String getComponentVendorName() { 123 return HarmonizedTariffScheduleCodeDetailConstants.COMPONENT_VENDOR_NAME; 124 } 125 126 @Override 127 public String getEntityTypeName() { 128 return HarmonizedTariffScheduleCodeDetailConstants.ENTITY_TYPE_NAME; 129 } 130 131 public PreparedStatement prepareStatement(String query) { 132 return session.prepareStatement(HarmonizedTariffScheduleCodeDetailFactory.class, query); 133 } 134 135 public HarmonizedTariffScheduleCodeDetailPK getNextPK() { 136 return new HarmonizedTariffScheduleCodeDetailPK(entityIdGenerator.getNextEntityId()); 137 } 138 139 public Set<HarmonizedTariffScheduleCodeDetailPK> getPKsFromResultSetAsSet(ResultSet rs) 140 throws PersistenceDatabaseException { 141 Set<HarmonizedTariffScheduleCodeDetailPK> _result = new HashSet<>(); 142 143 try { 144 while(rs.next()) { 145 _result.add(getPKFromResultSet(rs)); 146 } 147 } catch (SQLException se) { 148 throw new PersistenceDatabaseException(se); 149 } 150 151 return _result; 152 } 153 154 public java.util.List<HarmonizedTariffScheduleCodeDetailPK> getPKsFromResultSetAsList(ResultSet rs) 155 throws PersistenceDatabaseException { 156 java.util.List<HarmonizedTariffScheduleCodeDetailPK> _result = new ArrayList<>(); 157 158 try { 159 while(rs.next()) { 160 _result.add(getPKFromResultSet(rs)); 161 } 162 } catch (SQLException se) { 163 throw new PersistenceDatabaseException(se); 164 } 165 166 return _result; 167 } 168 169 public HarmonizedTariffScheduleCodeDetailPK getPKFromResultSet(ResultSet rs) 170 throws PersistenceDatabaseException { 171 HarmonizedTariffScheduleCodeDetailPK _result; 172 173 try { 174 long hztscdt_harmonizedtariffschedulecodedetailid = rs.getLong(HZTSCDT_HARMONIZEDTARIFFSCHEDULECODEDETAILID); 175 Long _entityId = rs.wasNull() ? null : hztscdt_harmonizedtariffschedulecodedetailid; 176 177 _result = new HarmonizedTariffScheduleCodeDetailPK(_entityId); 178 } catch (SQLException se) { 179 throw new PersistenceDatabaseException(se); 180 } 181 182 return _result; 183 } 184 185 public java.util.List<HarmonizedTariffScheduleCodeDetailValue> getValuesFromPKs(Collection<HarmonizedTariffScheduleCodeDetailPK> pks) 186 throws PersistenceDatabaseException { 187 java.util.List<HarmonizedTariffScheduleCodeDetailValue> _values = new ArrayList<>(pks.size()); 188 189 for(HarmonizedTariffScheduleCodeDetailPK _pk: pks) { 190 _values.add(getValueFromPK(_pk)); 191 } 192 193 return _values; 194 } 195 196 public HarmonizedTariffScheduleCodeDetailValue getValueFromPK(HarmonizedTariffScheduleCodeDetailPK pk) 197 throws PersistenceDatabaseException { 198 HarmonizedTariffScheduleCodeDetailValue _value; 199 200 // See if we already have the entity in the session cache 201 HarmonizedTariffScheduleCodeDetail _entity = (HarmonizedTariffScheduleCodeDetail)session.getEntity(pk); 202 if(_entity == null) 203 _value = getEntityFromPK(EntityPermission.READ_ONLY, pk).getHarmonizedTariffScheduleCodeDetailValue(); 204 else 205 _value = _entity.getHarmonizedTariffScheduleCodeDetailValue(); 206 207 return _value; 208 } 209 210 public java.util.List<HarmonizedTariffScheduleCodeDetailValue> getValuesFromResultSet(ResultSet rs) 211 throws PersistenceDatabaseException { 212 java.util.List<HarmonizedTariffScheduleCodeDetailValue> _result = new ArrayList<>(); 213 214 try { 215 while(rs.next()) { 216 _result.add(getValueFromResultSet(rs)); 217 } 218 } catch (SQLException se) { 219 throw new PersistenceDatabaseException(se); 220 } 221 222 return _result; 223 } 224 225 public HarmonizedTariffScheduleCodeDetailValue getValueFromResultSet(ResultSet rs) 226 throws PersistenceDatabaseException { 227 HarmonizedTariffScheduleCodeDetailValue _value; 228 229 try { 230 Long hztscdt_harmonizedtariffschedulecodedetailid = rs.getLong(HZTSCDT_HARMONIZEDTARIFFSCHEDULECODEDETAILID); 231 HarmonizedTariffScheduleCodeDetailPK _pk = new HarmonizedTariffScheduleCodeDetailPK(hztscdt_harmonizedtariffschedulecodedetailid); 232 233 // See if we already have the entity in the session cache 234 HarmonizedTariffScheduleCodeDetail _entity = (HarmonizedTariffScheduleCodeDetail)session.getEntity(_pk); 235 236 if(_entity == null) { 237 Long hztscdt_hztsc_harmonizedtariffschedulecodeid = rs.getLong(HZTSCDT_HZTSC_HARMONIZEDTARIFFSCHEDULECODEID); 238 if(rs.wasNull()) 239 hztscdt_hztsc_harmonizedtariffschedulecodeid = null; 240 241 Long hztscdt_countrygeocodeid = rs.getLong(HZTSCDT_COUNTRYGEOCODEID); 242 if(rs.wasNull()) 243 hztscdt_countrygeocodeid = null; 244 245 String hztscdt_harmonizedtariffschedulecodename = rs.getString(HZTSCDT_HARMONIZEDTARIFFSCHEDULECODENAME); 246 if(rs.wasNull()) 247 hztscdt_harmonizedtariffschedulecodename = null; 248 249 Long hztscdt_firstharmonizedtariffschedulecodeunitid = rs.getLong(HZTSCDT_FIRSTHARMONIZEDTARIFFSCHEDULECODEUNITID); 250 if(rs.wasNull()) 251 hztscdt_firstharmonizedtariffschedulecodeunitid = null; 252 253 Long hztscdt_secondharmonizedtariffschedulecodeunitid = rs.getLong(HZTSCDT_SECONDHARMONIZEDTARIFFSCHEDULECODEUNITID); 254 if(rs.wasNull()) 255 hztscdt_secondharmonizedtariffschedulecodeunitid = null; 256 257 Boolean hztscdt_isdefault = rs.getInt(HZTSCDT_ISDEFAULT) == 1; 258 if(rs.wasNull()) 259 hztscdt_isdefault = null; 260 261 Integer hztscdt_sortorder = rs.getInt(HZTSCDT_SORTORDER); 262 if(rs.wasNull()) 263 hztscdt_sortorder = null; 264 265 Long hztscdt_fromtime = rs.getLong(HZTSCDT_FROMTIME); 266 if(rs.wasNull()) 267 hztscdt_fromtime = null; 268 269 Long hztscdt_thrutime = rs.getLong(HZTSCDT_THRUTIME); 270 if(rs.wasNull()) 271 hztscdt_thrutime = null; 272 273 _value = new HarmonizedTariffScheduleCodeDetailValue(_pk, new HarmonizedTariffScheduleCodePK(hztscdt_hztsc_harmonizedtariffschedulecodeid), new GeoCodePK(hztscdt_countrygeocodeid), hztscdt_harmonizedtariffschedulecodename, new HarmonizedTariffScheduleCodeUnitPK(hztscdt_firstharmonizedtariffschedulecodeunitid), new HarmonizedTariffScheduleCodeUnitPK(hztscdt_secondharmonizedtariffschedulecodeunitid), hztscdt_isdefault, hztscdt_sortorder, hztscdt_fromtime, hztscdt_thrutime); 274 } else 275 _value = _entity.getHarmonizedTariffScheduleCodeDetailValue(); 276 } catch (SQLException se) { 277 throw new PersistenceDatabaseException(se); 278 } 279 280 return _value; 281 } 282 283 public java.util.List<HarmonizedTariffScheduleCodeDetail> getEntitiesFromPKs(EntityPermission entityPermission, Collection<HarmonizedTariffScheduleCodeDetailPK> pks) 284 throws PersistenceDatabaseException { 285 java.util.List<HarmonizedTariffScheduleCodeDetail> _entities = new ArrayList<>(pks.size()); 286 287 for(HarmonizedTariffScheduleCodeDetailPK _pk: pks) { 288 _entities.add(getEntityFromPK(entityPermission, _pk)); 289 } 290 291 return _entities; 292 } 293 294 public HarmonizedTariffScheduleCodeDetail getEntityFromValue(EntityPermission entityPermission, HarmonizedTariffScheduleCodeDetailValue value) { 295 return getEntityFromPK(entityPermission, value.getPrimaryKey()); 296 } 297 298 public HarmonizedTariffScheduleCodeDetail getEntityFromCache(HarmonizedTariffScheduleCodeDetailPK pk) { 299 HarmonizedTariffScheduleCodeDetailValue _value = (HarmonizedTariffScheduleCodeDetailValue)session.getValueCache().get(pk); 300 301 return _value == null ? null : new HarmonizedTariffScheduleCodeDetail(_value, EntityPermission.READ_ONLY); 302 } 303 304 public HarmonizedTariffScheduleCodeDetail getEntityFromPK(EntityPermission entityPermission, HarmonizedTariffScheduleCodeDetailPK pk) 305 throws PersistenceDatabaseException { 306 HarmonizedTariffScheduleCodeDetail _entity; 307 308 // See if we already have the entity in the session cache 309 _entity = (HarmonizedTariffScheduleCodeDetail)session.getEntity(pk); 310 if(_entity != null) { 311 // If the requested permission is READ_WRITE, and the cached permission is 312 // READ_ONLY, then pretend that the cached object wasn't found, and create 313 // a new entity that is READ_WRITE. 314 if(entityPermission.equals(EntityPermission.READ_WRITE)) { 315 if(_entity.getEntityPermission().equals(EntityPermission.READ_ONLY)) 316 _entity = null; 317 } 318 } 319 320 if(_entity == null && entityPermission.equals(EntityPermission.READ_ONLY)) { 321 _entity = getEntityFromCache(pk); 322 } 323 324 if(_entity == null) { 325 PreparedStatement _ps = session.prepareStatement(entityPermission.equals(EntityPermission.READ_ONLY)? SQL_SELECT_READ_ONLY: SQL_SELECT_READ_WRITE); 326 long _entityId = pk.getEntityId(); 327 ResultSet _rs = null; 328 329 try { 330 _ps.setLong(1, _entityId); 331 _rs = _ps.executeQuery(); 332 if(_rs.next()) { 333 _entity = getEntityFromResultSet(entityPermission, _rs); 334 } 335 } catch (SQLException se) { 336 throw new PersistenceDatabaseException(se); 337 } finally { 338 if(_rs != null) { 339 try { 340 _rs.close(); 341 } catch (SQLException se) { 342 // do nothing 343 } 344 } 345 } 346 } 347 348 return _entity; 349 } 350 351 public Set<HarmonizedTariffScheduleCodeDetailPK> getPKsFromQueryAsSet(PreparedStatement ps, final Object... params) 352 throws PersistenceDatabaseException { 353 Set<HarmonizedTariffScheduleCodeDetailPK> _pks; 354 ResultSet _rs = null; 355 356 try { 357 if(params.length != 0) { 358 Session.setQueryParams(ps, params); 359 } 360 361 _rs = ps.executeQuery(); 362 _pks = getPKsFromResultSetAsSet(_rs); 363 _rs.close(); 364 } catch (SQLException se) { 365 throw new PersistenceDatabaseException(se); 366 } finally { 367 if(_rs != null) { 368 try { 369 _rs.close(); 370 } catch (SQLException se) { 371 // do nothing 372 } 373 } 374 } 375 376 return _pks; 377 } 378 379 public java.util.List<HarmonizedTariffScheduleCodeDetailPK> getPKsFromQueryAsList(PreparedStatement ps, final Object... params) 380 throws PersistenceDatabaseException { 381 java.util.List<HarmonizedTariffScheduleCodeDetailPK> _pks; 382 ResultSet _rs = null; 383 384 try { 385 if(params.length != 0) { 386 Session.setQueryParams(ps, params); 387 } 388 389 _rs = ps.executeQuery(); 390 _pks = getPKsFromResultSetAsList(_rs); 391 _rs.close(); 392 } catch (SQLException se) { 393 throw new PersistenceDatabaseException(se); 394 } finally { 395 if(_rs != null) { 396 try { 397 _rs.close(); 398 } catch (SQLException se) { 399 // do nothing 400 } 401 } 402 } 403 404 return _pks; 405 } 406 407 public HarmonizedTariffScheduleCodeDetailPK getPKFromQuery(PreparedStatement ps, final Object... params) 408 throws PersistenceDatabaseException { 409 HarmonizedTariffScheduleCodeDetailPK _pk = null; 410 ResultSet _rs = null; 411 412 try { 413 if(params.length != 0) { 414 Session.setQueryParams(ps, params); 415 } 416 417 _rs = ps.executeQuery(); 418 if(_rs.next()) { 419 _pk = getPKFromResultSet(_rs); 420 } 421 _rs.close(); 422 } catch (SQLException se) { 423 throw new PersistenceDatabaseException(se); 424 } finally { 425 if(_rs != null) { 426 try { 427 _rs.close(); 428 } catch (SQLException se) { 429 // do nothing 430 } 431 } 432 } 433 434 return _pk; 435 } 436 437 public java.util.List<HarmonizedTariffScheduleCodeDetail> getEntitiesFromQuery(EntityPermission entityPermission, Map<EntityPermission, String>queryMap, final Object... params) 438 throws PersistenceDatabaseException { 439 PreparedStatement ps = session.prepareStatement(HarmonizedTariffScheduleCodeDetailFactory.class, queryMap.get(entityPermission)); 440 441 return getEntitiesFromQuery(entityPermission, ps, params); 442 } 443 444 public java.util.List<HarmonizedTariffScheduleCodeDetail> getEntitiesFromQuery(EntityPermission entityPermission, Map<EntityPermission, String>queryMap) 445 throws PersistenceDatabaseException { 446 PreparedStatement ps = session.prepareStatement(HarmonizedTariffScheduleCodeDetailFactory.class, queryMap.get(entityPermission)); 447 448 return getEntitiesFromQuery(entityPermission, ps); 449 } 450 451 public java.util.List<HarmonizedTariffScheduleCodeDetail> getEntitiesFromQuery(EntityPermission entityPermission, ResultQuery<?> query) 452 throws PersistenceDatabaseException { 453 PreparedStatement ps = session.prepareStatement(HarmonizedTariffScheduleCodeDetailFactory.class, query.getSQL()); 454 455 return getEntitiesFromQuery(entityPermission, ps, query.getBindValues().toArray()); 456 } 457 458 public java.util.List<HarmonizedTariffScheduleCodeDetail> getEntitiesFromQuery(EntityPermission entityPermission, PreparedStatement ps, final Object... params) 459 throws PersistenceDatabaseException { 460 java.util.List<HarmonizedTariffScheduleCodeDetail> _entities; 461 ResultSet _rs = null; 462 463 try { 464 if(params.length != 0) { 465 Session.setQueryParams(ps, params); 466 } 467 468 _rs = ps.executeQuery(); 469 _entities = getEntitiesFromResultSet(entityPermission, _rs); 470 _rs.close(); 471 } catch (SQLException se) { 472 throw new PersistenceDatabaseException(se); 473 } finally { 474 if(_rs != null) { 475 try { 476 _rs.close(); 477 } catch (SQLException se) { 478 // do nothing 479 } 480 } 481 } 482 483 return _entities; 484 } 485 486 public HarmonizedTariffScheduleCodeDetail getEntityFromQuery(EntityPermission entityPermission, Map<EntityPermission, String>queryMap, final Object... params) 487 throws PersistenceDatabaseException { 488 PreparedStatement ps = session.prepareStatement(HarmonizedTariffScheduleCodeDetailFactory.class, queryMap.get(entityPermission)); 489 490 return getEntityFromQuery(entityPermission, ps, params); 491 } 492 493 public HarmonizedTariffScheduleCodeDetail getEntityFromQuery(EntityPermission entityPermission, Map<EntityPermission, String>queryMap) 494 throws PersistenceDatabaseException { 495 PreparedStatement ps = session.prepareStatement(HarmonizedTariffScheduleCodeDetailFactory.class, queryMap.get(entityPermission)); 496 497 return getEntityFromQuery(entityPermission, ps); 498 } 499 500 public HarmonizedTariffScheduleCodeDetail getEntityFromQuery(EntityPermission entityPermission, ResultQuery<?> query) 501 throws PersistenceDatabaseException { 502 PreparedStatement ps = session.prepareStatement(HarmonizedTariffScheduleCodeDetailFactory.class, query.getSQL()); 503 504 return getEntityFromQuery(entityPermission, ps, query.getBindValues().toArray()); 505 } 506 507 public HarmonizedTariffScheduleCodeDetail getEntityFromQuery(EntityPermission entityPermission, PreparedStatement ps, final Object... params) 508 throws PersistenceDatabaseException { 509 HarmonizedTariffScheduleCodeDetail _entity = null; 510 ResultSet _rs = null; 511 512 try { 513 if(params.length != 0) { 514 Session.setQueryParams(ps, params); 515 } 516 517 _rs = ps.executeQuery(); 518 if(_rs.next()) { 519 _entity = getEntityFromResultSet(entityPermission, _rs); 520 } 521 _rs.close(); 522 } catch (SQLException se) { 523 throw new PersistenceDatabaseException(se); 524 } finally { 525 if(_rs != null) { 526 try { 527 _rs.close(); 528 } catch (SQLException se) { 529 // do nothing 530 } 531 } 532 } 533 534 return _entity; 535 } 536 537 public java.util.List<HarmonizedTariffScheduleCodeDetail> getEntitiesFromResultSet(EntityPermission entityPermission, ResultSet rs) 538 throws PersistenceDatabaseException { 539 java.util.List<HarmonizedTariffScheduleCodeDetail> _result = new ArrayList<>(); 540 541 try { 542 while(rs.next()) { 543 _result.add(getEntityFromResultSet(entityPermission, rs)); 544 } 545 } catch (SQLException se) { 546 throw new PersistenceDatabaseException(se); 547 } 548 549 return _result; 550 } 551 552 public HarmonizedTariffScheduleCodeDetail getEntityFromResultSet(EntityPermission entityPermission, ResultSet rs) 553 throws PersistenceDatabaseException { 554 HarmonizedTariffScheduleCodeDetail _entity; 555 556 try { 557 Long hztscdt_harmonizedtariffschedulecodedetailid = rs.getLong(HZTSCDT_HARMONIZEDTARIFFSCHEDULECODEDETAILID); 558 HarmonizedTariffScheduleCodeDetailPK _pk = new HarmonizedTariffScheduleCodeDetailPK(hztscdt_harmonizedtariffschedulecodedetailid); 559 560 // See if we already have the entity in the session cache 561 _entity = (HarmonizedTariffScheduleCodeDetail)session.getEntity(_pk); 562 if(_entity != null) { 563 // If the requested permission is READ_WRITE, and the cached permission is 564 // READ_ONLY, then pretend that the cached object wasn't found, and create 565 // a new entity that is READ_WRITE. 566 if(entityPermission.equals(EntityPermission.READ_WRITE)) { 567 if(_entity.getEntityPermission().equals(EntityPermission.READ_ONLY)) 568 _entity = null; 569 } 570 } 571 boolean foundInSessionCache = _entity != null; 572 573 if(_entity == null && entityPermission.equals(EntityPermission.READ_ONLY)) { 574 _entity = getEntityFromCache(_pk); 575 } 576 577 if(_entity == null) { 578 Long hztscdt_hztsc_harmonizedtariffschedulecodeid = rs.getLong(HZTSCDT_HZTSC_HARMONIZEDTARIFFSCHEDULECODEID); 579 if(rs.wasNull()) 580 hztscdt_hztsc_harmonizedtariffschedulecodeid = null; 581 582 Long hztscdt_countrygeocodeid = rs.getLong(HZTSCDT_COUNTRYGEOCODEID); 583 if(rs.wasNull()) 584 hztscdt_countrygeocodeid = null; 585 586 String hztscdt_harmonizedtariffschedulecodename = rs.getString(HZTSCDT_HARMONIZEDTARIFFSCHEDULECODENAME); 587 if(rs.wasNull()) 588 hztscdt_harmonizedtariffschedulecodename = null; 589 590 Long hztscdt_firstharmonizedtariffschedulecodeunitid = rs.getLong(HZTSCDT_FIRSTHARMONIZEDTARIFFSCHEDULECODEUNITID); 591 if(rs.wasNull()) 592 hztscdt_firstharmonizedtariffschedulecodeunitid = null; 593 594 Long hztscdt_secondharmonizedtariffschedulecodeunitid = rs.getLong(HZTSCDT_SECONDHARMONIZEDTARIFFSCHEDULECODEUNITID); 595 if(rs.wasNull()) 596 hztscdt_secondharmonizedtariffschedulecodeunitid = null; 597 598 Boolean hztscdt_isdefault = rs.getInt(HZTSCDT_ISDEFAULT) == 1; 599 if(rs.wasNull()) 600 hztscdt_isdefault = null; 601 602 Integer hztscdt_sortorder = rs.getInt(HZTSCDT_SORTORDER); 603 if(rs.wasNull()) 604 hztscdt_sortorder = null; 605 606 Long hztscdt_fromtime = rs.getLong(HZTSCDT_FROMTIME); 607 if(rs.wasNull()) 608 hztscdt_fromtime = null; 609 610 Long hztscdt_thrutime = rs.getLong(HZTSCDT_THRUTIME); 611 if(rs.wasNull()) 612 hztscdt_thrutime = null; 613 614 HarmonizedTariffScheduleCodeDetailValue _value = new HarmonizedTariffScheduleCodeDetailValue(_pk, hztscdt_hztsc_harmonizedtariffschedulecodeid == null? null: new HarmonizedTariffScheduleCodePK(hztscdt_hztsc_harmonizedtariffschedulecodeid), hztscdt_countrygeocodeid == null? null: new GeoCodePK(hztscdt_countrygeocodeid), hztscdt_harmonizedtariffschedulecodename, hztscdt_firstharmonizedtariffschedulecodeunitid == null? null: new HarmonizedTariffScheduleCodeUnitPK(hztscdt_firstharmonizedtariffschedulecodeunitid), hztscdt_secondharmonizedtariffschedulecodeunitid == null? null: new HarmonizedTariffScheduleCodeUnitPK(hztscdt_secondharmonizedtariffschedulecodeunitid), hztscdt_isdefault, hztscdt_sortorder, hztscdt_fromtime, hztscdt_thrutime); 615 _entity = new HarmonizedTariffScheduleCodeDetail(_value, entityPermission); 616 } 617 618 if(!foundInSessionCache) { 619 if(entityPermission.equals(EntityPermission.READ_ONLY)) { 620 session.putReadOnlyEntity(_pk, _entity); 621 session.getValueCache().put(_entity.getHarmonizedTariffScheduleCodeDetailValue()); 622 } else { 623 session.putReadWriteEntity(_pk, _entity); 624 } 625 } 626 } catch (SQLException se) { 627 throw new PersistenceDatabaseException(se); 628 } 629 630 return _entity; 631 } 632 633 public HarmonizedTariffScheduleCodeDetail create(HarmonizedTariffScheduleCode harmonizedTariffScheduleCode, GeoCode countryGeoCode, String harmonizedTariffScheduleCodeName, HarmonizedTariffScheduleCodeUnit firstHarmonizedTariffScheduleCodeUnit, HarmonizedTariffScheduleCodeUnit secondHarmonizedTariffScheduleCodeUnit, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 634 throws PersistenceDatabaseException, PersistenceNotNullException { 635 return create(harmonizedTariffScheduleCode == null ? null : harmonizedTariffScheduleCode.getPrimaryKey(), countryGeoCode == null ? null : countryGeoCode.getPrimaryKey(), harmonizedTariffScheduleCodeName, firstHarmonizedTariffScheduleCodeUnit == null ? null : firstHarmonizedTariffScheduleCodeUnit.getPrimaryKey(), secondHarmonizedTariffScheduleCodeUnit == null ? null : secondHarmonizedTariffScheduleCodeUnit.getPrimaryKey(), isDefault, sortOrder, fromTime, thruTime); 636 } 637 638 private void bindForCreate(PreparedStatement _ps, HarmonizedTariffScheduleCodeDetailValue _value) 639 throws SQLException { 640 _ps.setLong(1, _value.getEntityId()); 641 642 HarmonizedTariffScheduleCodePK hztscdt_hztsc_harmonizedtariffschedulecodeid = _value.getHarmonizedTariffScheduleCodePK(); 643 if(hztscdt_hztsc_harmonizedtariffschedulecodeid == null) 644 _ps.setNull(2, Types.BIGINT); 645 else 646 _ps.setLong(2, hztscdt_hztsc_harmonizedtariffschedulecodeid.getEntityId()); 647 648 GeoCodePK hztscdt_countrygeocodeid = _value.getCountryGeoCodePK(); 649 if(hztscdt_countrygeocodeid == null) 650 _ps.setNull(3, Types.BIGINT); 651 else 652 _ps.setLong(3, hztscdt_countrygeocodeid.getEntityId()); 653 654 String hztscdt_harmonizedtariffschedulecodename = _value.getHarmonizedTariffScheduleCodeName(); 655 if(hztscdt_harmonizedtariffschedulecodename == null) 656 _ps.setNull(4, Types.VARCHAR); 657 else 658 _ps.setString(4, hztscdt_harmonizedtariffschedulecodename); 659 660 HarmonizedTariffScheduleCodeUnitPK hztscdt_firstharmonizedtariffschedulecodeunitid = _value.getFirstHarmonizedTariffScheduleCodeUnitPK(); 661 if(hztscdt_firstharmonizedtariffschedulecodeunitid == null) 662 _ps.setNull(5, Types.BIGINT); 663 else 664 _ps.setLong(5, hztscdt_firstharmonizedtariffschedulecodeunitid.getEntityId()); 665 666 HarmonizedTariffScheduleCodeUnitPK hztscdt_secondharmonizedtariffschedulecodeunitid = _value.getSecondHarmonizedTariffScheduleCodeUnitPK(); 667 if(hztscdt_secondharmonizedtariffschedulecodeunitid == null) 668 _ps.setNull(6, Types.BIGINT); 669 else 670 _ps.setLong(6, hztscdt_secondharmonizedtariffschedulecodeunitid.getEntityId()); 671 672 Boolean hztscdt_isdefault = _value.getIsDefault(); 673 if(hztscdt_isdefault == null) 674 _ps.setNull(7, Types.BIT); 675 else 676 _ps.setInt(7, hztscdt_isdefault? 1: 0); 677 678 Integer hztscdt_sortorder = _value.getSortOrder(); 679 if(hztscdt_sortorder == null) 680 _ps.setNull(8, Types.INTEGER); 681 else 682 _ps.setInt(8, hztscdt_sortorder); 683 684 Long hztscdt_fromtime = _value.getFromTime(); 685 if(hztscdt_fromtime == null) 686 _ps.setNull(9, Types.BIGINT); 687 else 688 _ps.setLong(9, hztscdt_fromtime); 689 690 Long hztscdt_thrutime = _value.getThruTime(); 691 if(hztscdt_thrutime == null) 692 _ps.setNull(10, Types.BIGINT); 693 else 694 _ps.setLong(10, hztscdt_thrutime); 695 696 } 697 698 public HarmonizedTariffScheduleCodeDetail create(HarmonizedTariffScheduleCodePK harmonizedTariffScheduleCodePK, GeoCodePK countryGeoCodePK, String harmonizedTariffScheduleCodeName, HarmonizedTariffScheduleCodeUnitPK firstHarmonizedTariffScheduleCodeUnitPK, HarmonizedTariffScheduleCodeUnitPK secondHarmonizedTariffScheduleCodeUnitPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 699 throws PersistenceDatabaseException, PersistenceNotNullException { 700 HarmonizedTariffScheduleCodeDetailPK _pk = getNextPK(); 701 HarmonizedTariffScheduleCodeDetailValue _value = new HarmonizedTariffScheduleCodeDetailValue(_pk, harmonizedTariffScheduleCodePK, countryGeoCodePK, harmonizedTariffScheduleCodeName, firstHarmonizedTariffScheduleCodeUnitPK, secondHarmonizedTariffScheduleCodeUnitPK, isDefault, sortOrder, fromTime, thruTime); 702 703 PreparedStatement _ps = session.prepareStatement(SQL_INSERT); 704 705 try { 706 bindForCreate(_ps, _value); 707 708 if(PersistenceDebugFlags.CheckEntityInsertRowCount) { 709 int _count = _ps.executeUpdate(); 710 711 if(_count != 1) { 712 throw new PersistenceDatabaseUpdateException("insert failed, _count = " + _count); 713 } 714 } else { 715 _ps.executeUpdate(); 716 } 717 718 session.getValueCache().put(_value); 719 } catch (SQLException se) { 720 throw new PersistenceDatabaseException(se); 721 } 722 723 HarmonizedTariffScheduleCodeDetail _entity = new HarmonizedTariffScheduleCodeDetail(_value, EntityPermission.READ_ONLY); 724 session.putReadOnlyEntity(_pk, _entity); 725 726 return _entity; 727 } 728 729 public void create(Collection<HarmonizedTariffScheduleCodeDetailValue> _values) 730 throws PersistenceDatabaseException, PersistenceNotNullException { 731 int _size = _values.size(); 732 733 if(_size > 0) { 734 PreparedStatement _ps = session.prepareStatement(SQL_INSERT); 735 List<HarmonizedTariffScheduleCodeDetailValue> _cacheValues = new ArrayList<>(_size); 736 737 try { 738 for(HarmonizedTariffScheduleCodeDetailValue _value : _values) { 739 _value.setEntityId(entityIdGenerator.getNextEntityId()); 740 bindForCreate(_ps, _value); 741 742 _ps.addBatch(); 743 744 _cacheValues.add(_value); 745 } 746 747 if(PersistenceDebugFlags.CheckEntityInsertRowCount) { 748 int[] _counts = _ps.executeBatch(); 749 750 for(int _countOffset = 0 ; _countOffset < _size ; _countOffset++) { 751 if(_counts[_countOffset] != 1 && _counts[_countOffset] != PreparedStatement.SUCCESS_NO_INFO) { 752 throw new PersistenceDatabaseUpdateException("batch insert failed, _counts[" + _countOffset + "] = " + _counts[_countOffset]); 753 } 754 } 755 } else { 756 _ps.executeBatch(); 757 } 758 759 _ps.clearBatch(); 760 } catch (SQLException se) { 761 throw new PersistenceDatabaseException(se); 762 } 763 764 _cacheValues.forEach((_cacheValue) -> { 765 HarmonizedTariffScheduleCodeDetail _cacheEntity = new HarmonizedTariffScheduleCodeDetail(_cacheValue, EntityPermission.READ_ONLY); 766 767 session.putReadOnlyEntity(_cacheValue.getPrimaryKey(), _cacheEntity); 768 }); 769 } 770 } 771 772 private boolean bindForStore(PreparedStatement _ps, HarmonizedTariffScheduleCodeDetailValue _value) 773 throws SQLException { 774 boolean _hasBeenModified = _value.hasBeenModified(); 775 776 if(_hasBeenModified) { 777 HarmonizedTariffScheduleCodePK hztscdt_hztsc_harmonizedtariffschedulecodeid = _value.getHarmonizedTariffScheduleCodePK(); 778 if(hztscdt_hztsc_harmonizedtariffschedulecodeid == null) 779 _ps.setNull(1, Types.BIGINT); 780 else 781 _ps.setLong(1, hztscdt_hztsc_harmonizedtariffschedulecodeid.getEntityId()); 782 783 GeoCodePK hztscdt_countrygeocodeid = _value.getCountryGeoCodePK(); 784 if(hztscdt_countrygeocodeid == null) 785 _ps.setNull(2, Types.BIGINT); 786 else 787 _ps.setLong(2, hztscdt_countrygeocodeid.getEntityId()); 788 789 String hztscdt_harmonizedtariffschedulecodename = _value.getHarmonizedTariffScheduleCodeName(); 790 if(hztscdt_harmonizedtariffschedulecodename == null) 791 _ps.setNull(3, Types.VARCHAR); 792 else 793 _ps.setString(3, hztscdt_harmonizedtariffschedulecodename); 794 795 HarmonizedTariffScheduleCodeUnitPK hztscdt_firstharmonizedtariffschedulecodeunitid = _value.getFirstHarmonizedTariffScheduleCodeUnitPK(); 796 if(hztscdt_firstharmonizedtariffschedulecodeunitid == null) 797 _ps.setNull(4, Types.BIGINT); 798 else 799 _ps.setLong(4, hztscdt_firstharmonizedtariffschedulecodeunitid.getEntityId()); 800 801 HarmonizedTariffScheduleCodeUnitPK hztscdt_secondharmonizedtariffschedulecodeunitid = _value.getSecondHarmonizedTariffScheduleCodeUnitPK(); 802 if(hztscdt_secondharmonizedtariffschedulecodeunitid == null) 803 _ps.setNull(5, Types.BIGINT); 804 else 805 _ps.setLong(5, hztscdt_secondharmonizedtariffschedulecodeunitid.getEntityId()); 806 807 Boolean hztscdt_isdefault = _value.getIsDefault(); 808 if(hztscdt_isdefault == null) 809 _ps.setNull(6, Types.BIT); 810 else 811 _ps.setInt(6, hztscdt_isdefault? 1: 0); 812 813 Integer hztscdt_sortorder = _value.getSortOrder(); 814 if(hztscdt_sortorder == null) 815 _ps.setNull(7, Types.INTEGER); 816 else 817 _ps.setInt(7, hztscdt_sortorder); 818 819 Long hztscdt_fromtime = _value.getFromTime(); 820 if(hztscdt_fromtime == null) 821 _ps.setNull(8, Types.BIGINT); 822 else 823 _ps.setLong(8, hztscdt_fromtime); 824 825 Long hztscdt_thrutime = _value.getThruTime(); 826 if(hztscdt_thrutime == null) 827 _ps.setNull(9, Types.BIGINT); 828 else 829 _ps.setLong(9, hztscdt_thrutime); 830 831 _ps.setLong(10, _value.getPrimaryKey().getEntityId()); 832 833 _value.clearHasBeenModified(); 834 } 835 836 return _hasBeenModified; 837 } 838 839 @Override 840 public void store(HarmonizedTariffScheduleCodeDetail entity) 841 throws PersistenceDatabaseException { 842 PreparedStatement _ps = session.prepareStatement(SQL_UPDATE); 843 844 try { 845 HarmonizedTariffScheduleCodeDetailValue _value = entity.getHarmonizedTariffScheduleCodeDetailValue(); 846 847 if(bindForStore(_ps, _value)) { 848 if(PersistenceDebugFlags.CheckEntityUpdateRowCount) { 849 int _count = _ps.executeUpdate(); 850 851 if(_count != 1) { 852 throw new PersistenceDatabaseUpdateException("update failed, _count = " + _count); 853 } 854 } else { 855 _ps.executeUpdate(); 856 } 857 858 session.getValueCache().put(_value); 859 } 860 } catch (SQLException se) { 861 throw new PersistenceDatabaseException(se); 862 } 863 } 864 865 @Override 866 public void store(Collection<HarmonizedTariffScheduleCodeDetail> entities) 867 throws PersistenceDatabaseException { 868 if(entities.size() > 0) { 869 PreparedStatement _ps = session.prepareStatement(SQL_UPDATE); 870 int _modifiedEntities = 0; 871 872 try { 873 for(HarmonizedTariffScheduleCodeDetail entity : entities) { 874 if(bindForStore(_ps, entity.getHarmonizedTariffScheduleCodeDetailValue())) { 875 _ps.addBatch(); 876 _modifiedEntities++; 877 } 878 } 879 880 if(_modifiedEntities != 0) { 881 if(PersistenceDebugFlags.CheckEntityUpdateRowCount) { 882 int[] _counts = _ps.executeBatch(); 883 884 for(int _countOffset = 0 ; _countOffset < _modifiedEntities ; _countOffset++) { 885 if(_counts[_countOffset] != 1 && _counts[_countOffset] != PreparedStatement.SUCCESS_NO_INFO) { 886 throw new PersistenceDatabaseUpdateException("batch update failed, _counts[" + _countOffset + "] = " + _counts[_countOffset]); 887 } 888 } 889 } else { 890 _ps.executeBatch(); 891 } 892 893 _ps.clearBatch(); 894 895 entities.forEach((entity) -> { 896 session.getValueCache().put(entity.getHarmonizedTariffScheduleCodeDetailValue()); 897 }); 898 } 899 } catch (SQLException se) { 900 throw new PersistenceDatabaseException(se); 901 } 902 } 903 } 904 905 @Override 906 public void remove(HarmonizedTariffScheduleCodeDetail entity) 907 throws PersistenceDatabaseException { 908 remove(entity.getPrimaryKey()); 909 } 910 911 @Override 912 public void remove(HarmonizedTariffScheduleCodeDetailPK pk) 913 throws PersistenceDatabaseException { 914 PreparedStatement _ps = session.prepareStatement(SQL_DELETE); 915 long _entityId = pk.getEntityId(); 916 917 try { 918 _ps.setLong(1, _entityId); 919 920 if(PersistenceDebugFlags.CheckEntityDeleteRowCount) { 921 int _count = _ps.executeUpdate(); 922 923 if(_count != 1) { 924 throw new PersistenceDatabaseUpdateException("remove failed, _count = " + _count); 925 } 926 } else { 927 _ps.executeUpdate(); 928 } 929 930 session.getValueCache().remove(pk); 931 } catch (SQLException se) { 932 throw new PersistenceDatabaseException(se); 933 } 934 935 session.removed(pk, false); 936 } 937 938 @Override 939 public void remove(Collection<HarmonizedTariffScheduleCodeDetailPK> pks) 940 throws PersistenceDatabaseException { 941 if(pks.size() > 0) { 942 PreparedStatement _ps = session.prepareStatement(SQL_DELETE); 943 int _modifiedEntities = 0; 944 945 try { 946 for(HarmonizedTariffScheduleCodeDetailPK pk : pks) { 947 long _entityId = pk.getEntityId(); 948 949 _ps.setLong(1, _entityId); 950 951 _ps.addBatch(); 952 _modifiedEntities++; 953 } 954 955 if(_modifiedEntities != 0) { 956 if(PersistenceDebugFlags.CheckEntityDeleteRowCount) { 957 int[] _counts = _ps.executeBatch(); 958 959 for(int _countOffset = 0 ; _countOffset < _modifiedEntities ; _countOffset++) { 960 if(_counts[_countOffset] != 1 && _counts[_countOffset] != PreparedStatement.SUCCESS_NO_INFO) { 961 throw new PersistenceDatabaseUpdateException("batch remove failed, _counts[" + _countOffset + "] = " + _counts[_countOffset]); 962 } 963 } 964 } else { 965 _ps.executeBatch(); 966 } 967 968 _ps.clearBatch(); 969 970 pks.forEach((pk) -> { 971 session.getValueCache().remove(pk); 972 }); 973 } 974 } catch (SQLException se) { 975 throw new PersistenceDatabaseException(se); 976 } 977 978 pks.forEach((pk) -> { 979 session.removed(pk, true); 980 }); 981 } 982 } 983 984 @Override 985 public boolean validPK(HarmonizedTariffScheduleCodeDetailPK pk) 986 throws PersistenceDatabaseException { 987 boolean valid = false; 988 PreparedStatement _ps = session.prepareStatement(SQL_VALID); 989 ResultSet _rs = null; 990 991 try { 992 _ps.setLong(1, pk.getEntityId()); 993 994 _rs = _ps.executeQuery(); 995 if(_rs.next()) { 996 long _count = _rs.getLong(1); 997 if(_rs.wasNull()) 998 _count = 0; 999 1000 if(_count == 1) 1001 valid = true; 1002 } 1003 } catch (SQLException se) { 1004 throw new PersistenceDatabaseException(se); 1005 } finally { 1006 if(_rs != null) { 1007 try { 1008 _rs.close(); 1009 } catch (SQLException se) { 1010 // do nothing 1011 } 1012 } 1013 } 1014 1015 return valid; 1016 } 1017 1018}