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 * CurrencyFactory.java 021 */ 022 023package com.echothree.model.data.accounting.server.factory; 024 025import com.echothree.model.data.accounting.common.pk.SymbolPositionPK; 026 027import com.echothree.model.data.accounting.server.entity.SymbolPosition; 028 029import com.echothree.model.data.accounting.common.CurrencyConstants; 030import com.echothree.model.data.accounting.common.pk.CurrencyPK; 031import com.echothree.model.data.accounting.server.value.CurrencyValue; 032import com.echothree.model.data.accounting.server.entity.Currency; 033import com.echothree.util.common.exception.PersistenceDatabaseException; 034import com.echothree.util.common.exception.PersistenceDatabaseUpdateException; 035import com.echothree.util.common.exception.PersistenceNotNullException; 036import com.echothree.util.server.persistence.BaseFactory; 037import com.echothree.util.server.persistence.EntityIdGenerator; 038import com.echothree.util.server.persistence.EntityPermission; 039import com.echothree.util.server.persistence.PersistenceDebugFlags; 040import com.echothree.util.server.persistence.Session; 041import java.sql.PreparedStatement; 042import java.sql.ResultSet; 043import java.sql.SQLException; 044import java.sql.Types; 045import java.io.ByteArrayInputStream; 046import java.io.StringReader; 047import java.util.ArrayList; 048import java.util.Collection; 049import java.util.HashSet; 050import java.util.List; 051import java.util.Map; 052import java.util.Set; 053import javax.enterprise.context.ApplicationScoped; 054import javax.enterprise.inject.spi.CDI; 055import javax.inject.Inject; 056import org.slf4j.Logger; 057import org.slf4j.LoggerFactory; 058 059@ApplicationScoped 060public class CurrencyFactory 061 implements BaseFactory<CurrencyPK, Currency> { 062 063 @Inject 064 Session session; 065 066 //private static final Logger log = LoggerFactory.getLogger(CurrencyFactory.class); 067 068 final private static String SQL_SELECT_READ_ONLY = "SELECT cur_currencyid, cur_currencyisoname, cur_symbol, cur_sympos_symbolpositionid, cur_symbolonliststart, cur_symbolonlistmember, cur_symbolonsubtotal, cur_symbolontotal, cur_groupingseparator, cur_groupingsize, cur_fractionseparator, cur_defaultfractiondigits, cur_priceunitfractiondigits, cur_pricelinefractiondigits, cur_costunitfractiondigits, cur_costlinefractiondigits, cur_minussign, cur_isdefault, cur_sortorder FROM currencies WHERE cur_currencyid = ?"; 069 final private static String SQL_SELECT_READ_WRITE = "SELECT cur_currencyid, cur_currencyisoname, cur_symbol, cur_sympos_symbolpositionid, cur_symbolonliststart, cur_symbolonlistmember, cur_symbolonsubtotal, cur_symbolontotal, cur_groupingseparator, cur_groupingsize, cur_fractionseparator, cur_defaultfractiondigits, cur_priceunitfractiondigits, cur_pricelinefractiondigits, cur_costunitfractiondigits, cur_costlinefractiondigits, cur_minussign, cur_isdefault, cur_sortorder FROM currencies WHERE cur_currencyid = ? FOR UPDATE"; 070 final private static String SQL_INSERT = "INSERT INTO currencies (cur_currencyid, cur_currencyisoname, cur_symbol, cur_sympos_symbolpositionid, cur_symbolonliststart, cur_symbolonlistmember, cur_symbolonsubtotal, cur_symbolontotal, cur_groupingseparator, cur_groupingsize, cur_fractionseparator, cur_defaultfractiondigits, cur_priceunitfractiondigits, cur_pricelinefractiondigits, cur_costunitfractiondigits, cur_costlinefractiondigits, cur_minussign, cur_isdefault, cur_sortorder) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; 071 final private static String SQL_UPDATE = "UPDATE currencies SET cur_currencyisoname = ?, cur_symbol = ?, cur_sympos_symbolpositionid = ?, cur_symbolonliststart = ?, cur_symbolonlistmember = ?, cur_symbolonsubtotal = ?, cur_symbolontotal = ?, cur_groupingseparator = ?, cur_groupingsize = ?, cur_fractionseparator = ?, cur_defaultfractiondigits = ?, cur_priceunitfractiondigits = ?, cur_pricelinefractiondigits = ?, cur_costunitfractiondigits = ?, cur_costlinefractiondigits = ?, cur_minussign = ?, cur_isdefault = ?, cur_sortorder = ? WHERE cur_currencyid = ?"; 072 final private static String SQL_DELETE = "DELETE FROM currencies WHERE cur_currencyid = ?"; 073 final private static String SQL_VALID = "SELECT COUNT(*) FROM currencies WHERE cur_currencyid = ?"; 074 075 final private static String PK_COLUMN = "cur_currencyid"; 076 final private static String ALL_COLUMNS = "cur_currencyid, cur_currencyisoname, cur_symbol, cur_sympos_symbolpositionid, cur_symbolonliststart, cur_symbolonlistmember, cur_symbolonsubtotal, cur_symbolontotal, cur_groupingseparator, cur_groupingsize, cur_fractionseparator, cur_defaultfractiondigits, cur_priceunitfractiondigits, cur_pricelinefractiondigits, cur_costunitfractiondigits, cur_costlinefractiondigits, cur_minussign, cur_isdefault, cur_sortorder"; 077 final public static String TABLE_NAME = "currencies"; 078 079 final public static String CUR_CURRENCYID = "cur_currencyid"; 080 final public static String CUR_CURRENCYISONAME = "cur_currencyisoname"; 081 final public static String CUR_SYMBOL = "cur_symbol"; 082 final public static String CUR_SYMPOS_SYMBOLPOSITIONID = "cur_sympos_symbolpositionid"; 083 final public static String CUR_SYMBOLONLISTSTART = "cur_symbolonliststart"; 084 final public static String CUR_SYMBOLONLISTMEMBER = "cur_symbolonlistmember"; 085 final public static String CUR_SYMBOLONSUBTOTAL = "cur_symbolonsubtotal"; 086 final public static String CUR_SYMBOLONTOTAL = "cur_symbolontotal"; 087 final public static String CUR_GROUPINGSEPARATOR = "cur_groupingseparator"; 088 final public static String CUR_GROUPINGSIZE = "cur_groupingsize"; 089 final public static String CUR_FRACTIONSEPARATOR = "cur_fractionseparator"; 090 final public static String CUR_DEFAULTFRACTIONDIGITS = "cur_defaultfractiondigits"; 091 final public static String CUR_PRICEUNITFRACTIONDIGITS = "cur_priceunitfractiondigits"; 092 final public static String CUR_PRICELINEFRACTIONDIGITS = "cur_pricelinefractiondigits"; 093 final public static String CUR_COSTUNITFRACTIONDIGITS = "cur_costunitfractiondigits"; 094 final public static String CUR_COSTLINEFRACTIONDIGITS = "cur_costlinefractiondigits"; 095 final public static String CUR_MINUSSIGN = "cur_minussign"; 096 final public static String CUR_ISDEFAULT = "cur_isdefault"; 097 final public static String CUR_SORTORDER = "cur_sortorder"; 098 099 final private static EntityIdGenerator entityIdGenerator = new EntityIdGenerator(CurrencyConstants.COMPONENT_VENDOR_NAME, CurrencyConstants.ENTITY_TYPE_NAME); 100 101 /** Creates a new instance of CurrencyFactory */ 102 protected CurrencyFactory() { 103 super(); 104 } 105 106 public static CurrencyFactory getInstance() { 107 return CDI.current().select(CurrencyFactory.class).get(); 108 } 109 110 @Override 111 public String getPKColumn() { 112 return PK_COLUMN; 113 } 114 115 @Override 116 public String getAllColumns() { 117 return ALL_COLUMNS; 118 } 119 120 @Override 121 public String getTableName() { 122 return TABLE_NAME; 123 } 124 125 @Override 126 public String getComponentVendorName() { 127 return CurrencyConstants.COMPONENT_VENDOR_NAME; 128 } 129 130 @Override 131 public String getEntityTypeName() { 132 return CurrencyConstants.ENTITY_TYPE_NAME; 133 } 134 135 public PreparedStatement prepareStatement(String query) { 136 return session.prepareStatement(CurrencyFactory.class, query); 137 } 138 139 public CurrencyPK getNextPK() { 140 return new CurrencyPK(entityIdGenerator.getNextEntityId()); 141 } 142 143 public Set<CurrencyPK> getPKsFromResultSetAsSet(ResultSet rs) 144 throws PersistenceDatabaseException { 145 Set<CurrencyPK> _result = new HashSet<>(); 146 147 try { 148 while(rs.next()) { 149 _result.add(getPKFromResultSet(rs)); 150 } 151 } catch (SQLException se) { 152 throw new PersistenceDatabaseException(se); 153 } 154 155 return _result; 156 } 157 158 public java.util.List<CurrencyPK> getPKsFromResultSetAsList(ResultSet rs) 159 throws PersistenceDatabaseException { 160 java.util.List<CurrencyPK> _result = new ArrayList<>(); 161 162 try { 163 while(rs.next()) { 164 _result.add(getPKFromResultSet(rs)); 165 } 166 } catch (SQLException se) { 167 throw new PersistenceDatabaseException(se); 168 } 169 170 return _result; 171 } 172 173 public CurrencyPK getPKFromResultSet(ResultSet rs) 174 throws PersistenceDatabaseException { 175 CurrencyPK _result; 176 177 try { 178 long cur_currencyid = rs.getLong(CUR_CURRENCYID); 179 Long _entityId = rs.wasNull() ? null : cur_currencyid; 180 181 _result = new CurrencyPK(_entityId); 182 } catch (SQLException se) { 183 throw new PersistenceDatabaseException(se); 184 } 185 186 return _result; 187 } 188 189 public java.util.List<CurrencyValue> getValuesFromPKs(Collection<CurrencyPK> pks) 190 throws PersistenceDatabaseException { 191 java.util.List<CurrencyValue> _values = new ArrayList<>(pks.size()); 192 193 for(CurrencyPK _pk: pks) { 194 _values.add(getValueFromPK(_pk)); 195 } 196 197 return _values; 198 } 199 200 public CurrencyValue getValueFromPK(CurrencyPK pk) 201 throws PersistenceDatabaseException { 202 CurrencyValue _value; 203 204 // See if we already have the entity in the session cache 205 Currency _entity = (Currency)session.getEntity(pk); 206 if(_entity == null) 207 _value = getEntityFromPK(EntityPermission.READ_ONLY, pk).getCurrencyValue(); 208 else 209 _value = _entity.getCurrencyValue(); 210 211 return _value; 212 } 213 214 public java.util.List<CurrencyValue> getValuesFromResultSet(ResultSet rs) 215 throws PersistenceDatabaseException { 216 java.util.List<CurrencyValue> _result = new ArrayList<>(); 217 218 try { 219 while(rs.next()) { 220 _result.add(getValueFromResultSet(rs)); 221 } 222 } catch (SQLException se) { 223 throw new PersistenceDatabaseException(se); 224 } 225 226 return _result; 227 } 228 229 public CurrencyValue getValueFromResultSet(ResultSet rs) 230 throws PersistenceDatabaseException { 231 CurrencyValue _value; 232 233 try { 234 Long cur_currencyid = rs.getLong(CUR_CURRENCYID); 235 CurrencyPK _pk = new CurrencyPK(cur_currencyid); 236 237 // See if we already have the entity in the session cache 238 Currency _entity = (Currency)session.getEntity(_pk); 239 240 if(_entity == null) { 241 String cur_currencyisoname = rs.getString(CUR_CURRENCYISONAME); 242 if(rs.wasNull()) 243 cur_currencyisoname = null; 244 245 String cur_symbol = rs.getString(CUR_SYMBOL); 246 if(rs.wasNull()) 247 cur_symbol = null; 248 249 Long cur_sympos_symbolpositionid = rs.getLong(CUR_SYMPOS_SYMBOLPOSITIONID); 250 if(rs.wasNull()) 251 cur_sympos_symbolpositionid = null; 252 253 Boolean cur_symbolonliststart = rs.getInt(CUR_SYMBOLONLISTSTART) == 1; 254 if(rs.wasNull()) 255 cur_symbolonliststart = null; 256 257 Boolean cur_symbolonlistmember = rs.getInt(CUR_SYMBOLONLISTMEMBER) == 1; 258 if(rs.wasNull()) 259 cur_symbolonlistmember = null; 260 261 Boolean cur_symbolonsubtotal = rs.getInt(CUR_SYMBOLONSUBTOTAL) == 1; 262 if(rs.wasNull()) 263 cur_symbolonsubtotal = null; 264 265 Boolean cur_symbolontotal = rs.getInt(CUR_SYMBOLONTOTAL) == 1; 266 if(rs.wasNull()) 267 cur_symbolontotal = null; 268 269 String cur_groupingseparator = rs.getString(CUR_GROUPINGSEPARATOR); 270 if(rs.wasNull()) 271 cur_groupingseparator = null; 272 273 Integer cur_groupingsize = rs.getInt(CUR_GROUPINGSIZE); 274 if(rs.wasNull()) 275 cur_groupingsize = null; 276 277 String cur_fractionseparator = rs.getString(CUR_FRACTIONSEPARATOR); 278 if(rs.wasNull()) 279 cur_fractionseparator = null; 280 281 Integer cur_defaultfractiondigits = rs.getInt(CUR_DEFAULTFRACTIONDIGITS); 282 if(rs.wasNull()) 283 cur_defaultfractiondigits = null; 284 285 Integer cur_priceunitfractiondigits = rs.getInt(CUR_PRICEUNITFRACTIONDIGITS); 286 if(rs.wasNull()) 287 cur_priceunitfractiondigits = null; 288 289 Integer cur_pricelinefractiondigits = rs.getInt(CUR_PRICELINEFRACTIONDIGITS); 290 if(rs.wasNull()) 291 cur_pricelinefractiondigits = null; 292 293 Integer cur_costunitfractiondigits = rs.getInt(CUR_COSTUNITFRACTIONDIGITS); 294 if(rs.wasNull()) 295 cur_costunitfractiondigits = null; 296 297 Integer cur_costlinefractiondigits = rs.getInt(CUR_COSTLINEFRACTIONDIGITS); 298 if(rs.wasNull()) 299 cur_costlinefractiondigits = null; 300 301 String cur_minussign = rs.getString(CUR_MINUSSIGN); 302 if(rs.wasNull()) 303 cur_minussign = null; 304 305 Boolean cur_isdefault = rs.getInt(CUR_ISDEFAULT) == 1; 306 if(rs.wasNull()) 307 cur_isdefault = null; 308 309 Integer cur_sortorder = rs.getInt(CUR_SORTORDER); 310 if(rs.wasNull()) 311 cur_sortorder = null; 312 313 _value = new CurrencyValue(_pk, cur_currencyisoname, cur_symbol, new SymbolPositionPK(cur_sympos_symbolpositionid), cur_symbolonliststart, cur_symbolonlistmember, cur_symbolonsubtotal, cur_symbolontotal, cur_groupingseparator, cur_groupingsize, cur_fractionseparator, cur_defaultfractiondigits, cur_priceunitfractiondigits, cur_pricelinefractiondigits, cur_costunitfractiondigits, cur_costlinefractiondigits, cur_minussign, cur_isdefault, cur_sortorder); 314 } else 315 _value = _entity.getCurrencyValue(); 316 } catch (SQLException se) { 317 throw new PersistenceDatabaseException(se); 318 } 319 320 return _value; 321 } 322 323 public java.util.List<Currency> getEntitiesFromPKs(EntityPermission entityPermission, Collection<CurrencyPK> pks) 324 throws PersistenceDatabaseException { 325 java.util.List<Currency> _entities = new ArrayList<>(pks.size()); 326 327 for(CurrencyPK _pk: pks) { 328 _entities.add(getEntityFromPK(entityPermission, _pk)); 329 } 330 331 return _entities; 332 } 333 334 public Currency getEntityFromValue(EntityPermission entityPermission, CurrencyValue value) { 335 return getEntityFromPK(entityPermission, value.getPrimaryKey()); 336 } 337 338 public Currency getEntityFromCache(CurrencyPK pk) { 339 CurrencyValue _value = (CurrencyValue)session.getValueCache().get(pk); 340 341 return _value == null ? null : new Currency(_value, EntityPermission.READ_ONLY); 342 } 343 344 public Currency getEntityFromPK(EntityPermission entityPermission, CurrencyPK pk) 345 throws PersistenceDatabaseException { 346 Currency _entity; 347 348 // See if we already have the entity in the session cache 349 _entity = (Currency)session.getEntity(pk); 350 if(_entity != null) { 351 // If the requested permission is READ_WRITE, and the cached permission is 352 // READ_ONLY, then pretend that the cached object wasn't found, and create 353 // a new entity that is READ_WRITE. 354 if(entityPermission.equals(EntityPermission.READ_WRITE)) { 355 if(_entity.getEntityPermission().equals(EntityPermission.READ_ONLY)) 356 _entity = null; 357 } 358 } 359 360 if(_entity == null && entityPermission.equals(EntityPermission.READ_ONLY)) { 361 _entity = getEntityFromCache(pk); 362 } 363 364 if(_entity == null) { 365 PreparedStatement _ps = session.prepareStatement(entityPermission.equals(EntityPermission.READ_ONLY)? SQL_SELECT_READ_ONLY: SQL_SELECT_READ_WRITE); 366 long _entityId = pk.getEntityId(); 367 ResultSet _rs = null; 368 369 try { 370 _ps.setLong(1, _entityId); 371 _rs = _ps.executeQuery(); 372 if(_rs.next()) { 373 _entity = getEntityFromResultSet(entityPermission, _rs); 374 } 375 } catch (SQLException se) { 376 throw new PersistenceDatabaseException(se); 377 } finally { 378 if(_rs != null) { 379 try { 380 _rs.close(); 381 } catch (SQLException se) { 382 // do nothing 383 } 384 } 385 } 386 } 387 388 return _entity; 389 } 390 391 public Set<CurrencyPK> getPKsFromQueryAsSet(PreparedStatement ps, final Object... params) 392 throws PersistenceDatabaseException { 393 Set<CurrencyPK> _pks; 394 ResultSet _rs = null; 395 396 try { 397 if(params.length != 0) { 398 Session.setQueryParams(ps, params); 399 } 400 401 _rs = ps.executeQuery(); 402 _pks = getPKsFromResultSetAsSet(_rs); 403 _rs.close(); 404 } catch (SQLException se) { 405 throw new PersistenceDatabaseException(se); 406 } finally { 407 if(_rs != null) { 408 try { 409 _rs.close(); 410 } catch (SQLException se) { 411 // do nothing 412 } 413 } 414 } 415 416 return _pks; 417 } 418 419 public java.util.List<CurrencyPK> getPKsFromQueryAsList(PreparedStatement ps, final Object... params) 420 throws PersistenceDatabaseException { 421 java.util.List<CurrencyPK> _pks; 422 ResultSet _rs = null; 423 424 try { 425 if(params.length != 0) { 426 Session.setQueryParams(ps, params); 427 } 428 429 _rs = ps.executeQuery(); 430 _pks = getPKsFromResultSetAsList(_rs); 431 _rs.close(); 432 } catch (SQLException se) { 433 throw new PersistenceDatabaseException(se); 434 } finally { 435 if(_rs != null) { 436 try { 437 _rs.close(); 438 } catch (SQLException se) { 439 // do nothing 440 } 441 } 442 } 443 444 return _pks; 445 } 446 447 public CurrencyPK getPKFromQuery(PreparedStatement ps, final Object... params) 448 throws PersistenceDatabaseException { 449 CurrencyPK _pk = null; 450 ResultSet _rs = null; 451 452 try { 453 if(params.length != 0) { 454 Session.setQueryParams(ps, params); 455 } 456 457 _rs = ps.executeQuery(); 458 if(_rs.next()) { 459 _pk = getPKFromResultSet(_rs); 460 } 461 _rs.close(); 462 } catch (SQLException se) { 463 throw new PersistenceDatabaseException(se); 464 } finally { 465 if(_rs != null) { 466 try { 467 _rs.close(); 468 } catch (SQLException se) { 469 // do nothing 470 } 471 } 472 } 473 474 return _pk; 475 } 476 477 public java.util.List<Currency> getEntitiesFromQuery(EntityPermission entityPermission, Map<EntityPermission, String>queryMap, final Object... params) 478 throws PersistenceDatabaseException { 479 PreparedStatement ps = session.prepareStatement(CurrencyFactory.class, queryMap.get(entityPermission)); 480 481 return getEntitiesFromQuery(entityPermission, ps, params); 482 } 483 484 public java.util.List<Currency> getEntitiesFromQuery(EntityPermission entityPermission, Map<EntityPermission, String>queryMap) 485 throws PersistenceDatabaseException { 486 PreparedStatement ps = session.prepareStatement(CurrencyFactory.class, queryMap.get(entityPermission)); 487 488 return getEntitiesFromQuery(entityPermission, ps); 489 } 490 491 public java.util.List<Currency> getEntitiesFromQuery(EntityPermission entityPermission, PreparedStatement ps, final Object... params) 492 throws PersistenceDatabaseException { 493 java.util.List<Currency> _entities; 494 ResultSet _rs = null; 495 496 try { 497 if(params.length != 0) { 498 Session.setQueryParams(ps, params); 499 } 500 501 _rs = ps.executeQuery(); 502 _entities = getEntitiesFromResultSet(entityPermission, _rs); 503 _rs.close(); 504 } catch (SQLException se) { 505 throw new PersistenceDatabaseException(se); 506 } finally { 507 if(_rs != null) { 508 try { 509 _rs.close(); 510 } catch (SQLException se) { 511 // do nothing 512 } 513 } 514 } 515 516 return _entities; 517 } 518 519 public Currency getEntityFromQuery(EntityPermission entityPermission, Map<EntityPermission, String>queryMap, final Object... params) 520 throws PersistenceDatabaseException { 521 PreparedStatement ps = session.prepareStatement(CurrencyFactory.class, queryMap.get(entityPermission)); 522 523 return getEntityFromQuery(entityPermission, ps, params); 524 } 525 526 public Currency getEntityFromQuery(EntityPermission entityPermission, Map<EntityPermission, String>queryMap) 527 throws PersistenceDatabaseException { 528 PreparedStatement ps = session.prepareStatement(CurrencyFactory.class, queryMap.get(entityPermission)); 529 530 return getEntityFromQuery(entityPermission, ps); 531 } 532 533 public Currency getEntityFromQuery(EntityPermission entityPermission, PreparedStatement ps, final Object... params) 534 throws PersistenceDatabaseException { 535 Currency _entity = null; 536 ResultSet _rs = null; 537 538 try { 539 if(params.length != 0) { 540 Session.setQueryParams(ps, params); 541 } 542 543 _rs = ps.executeQuery(); 544 if(_rs.next()) { 545 _entity = getEntityFromResultSet(entityPermission, _rs); 546 } 547 _rs.close(); 548 } catch (SQLException se) { 549 throw new PersistenceDatabaseException(se); 550 } finally { 551 if(_rs != null) { 552 try { 553 _rs.close(); 554 } catch (SQLException se) { 555 // do nothing 556 } 557 } 558 } 559 560 return _entity; 561 } 562 563 public java.util.List<Currency> getEntitiesFromResultSet(EntityPermission entityPermission, ResultSet rs) 564 throws PersistenceDatabaseException { 565 java.util.List<Currency> _result = new ArrayList<>(); 566 567 try { 568 while(rs.next()) { 569 _result.add(getEntityFromResultSet(entityPermission, rs)); 570 } 571 } catch (SQLException se) { 572 throw new PersistenceDatabaseException(se); 573 } 574 575 return _result; 576 } 577 578 public Currency getEntityFromResultSet(EntityPermission entityPermission, ResultSet rs) 579 throws PersistenceDatabaseException { 580 Currency _entity; 581 582 try { 583 Long cur_currencyid = rs.getLong(CUR_CURRENCYID); 584 CurrencyPK _pk = new CurrencyPK(cur_currencyid); 585 586 // See if we already have the entity in the session cache 587 _entity = (Currency)session.getEntity(_pk); 588 if(_entity != null) { 589 // If the requested permission is READ_WRITE, and the cached permission is 590 // READ_ONLY, then pretend that the cached object wasn't found, and create 591 // a new entity that is READ_WRITE. 592 if(entityPermission.equals(EntityPermission.READ_WRITE)) { 593 if(_entity.getEntityPermission().equals(EntityPermission.READ_ONLY)) 594 _entity = null; 595 } 596 } 597 boolean foundInSessionCache = _entity != null; 598 599 if(_entity == null && entityPermission.equals(EntityPermission.READ_ONLY)) { 600 _entity = getEntityFromCache(_pk); 601 } 602 603 if(_entity == null) { 604 String cur_currencyisoname = rs.getString(CUR_CURRENCYISONAME); 605 if(rs.wasNull()) 606 cur_currencyisoname = null; 607 608 String cur_symbol = rs.getString(CUR_SYMBOL); 609 if(rs.wasNull()) 610 cur_symbol = null; 611 612 Long cur_sympos_symbolpositionid = rs.getLong(CUR_SYMPOS_SYMBOLPOSITIONID); 613 if(rs.wasNull()) 614 cur_sympos_symbolpositionid = null; 615 616 Boolean cur_symbolonliststart = rs.getInt(CUR_SYMBOLONLISTSTART) == 1; 617 if(rs.wasNull()) 618 cur_symbolonliststart = null; 619 620 Boolean cur_symbolonlistmember = rs.getInt(CUR_SYMBOLONLISTMEMBER) == 1; 621 if(rs.wasNull()) 622 cur_symbolonlistmember = null; 623 624 Boolean cur_symbolonsubtotal = rs.getInt(CUR_SYMBOLONSUBTOTAL) == 1; 625 if(rs.wasNull()) 626 cur_symbolonsubtotal = null; 627 628 Boolean cur_symbolontotal = rs.getInt(CUR_SYMBOLONTOTAL) == 1; 629 if(rs.wasNull()) 630 cur_symbolontotal = null; 631 632 String cur_groupingseparator = rs.getString(CUR_GROUPINGSEPARATOR); 633 if(rs.wasNull()) 634 cur_groupingseparator = null; 635 636 Integer cur_groupingsize = rs.getInt(CUR_GROUPINGSIZE); 637 if(rs.wasNull()) 638 cur_groupingsize = null; 639 640 String cur_fractionseparator = rs.getString(CUR_FRACTIONSEPARATOR); 641 if(rs.wasNull()) 642 cur_fractionseparator = null; 643 644 Integer cur_defaultfractiondigits = rs.getInt(CUR_DEFAULTFRACTIONDIGITS); 645 if(rs.wasNull()) 646 cur_defaultfractiondigits = null; 647 648 Integer cur_priceunitfractiondigits = rs.getInt(CUR_PRICEUNITFRACTIONDIGITS); 649 if(rs.wasNull()) 650 cur_priceunitfractiondigits = null; 651 652 Integer cur_pricelinefractiondigits = rs.getInt(CUR_PRICELINEFRACTIONDIGITS); 653 if(rs.wasNull()) 654 cur_pricelinefractiondigits = null; 655 656 Integer cur_costunitfractiondigits = rs.getInt(CUR_COSTUNITFRACTIONDIGITS); 657 if(rs.wasNull()) 658 cur_costunitfractiondigits = null; 659 660 Integer cur_costlinefractiondigits = rs.getInt(CUR_COSTLINEFRACTIONDIGITS); 661 if(rs.wasNull()) 662 cur_costlinefractiondigits = null; 663 664 String cur_minussign = rs.getString(CUR_MINUSSIGN); 665 if(rs.wasNull()) 666 cur_minussign = null; 667 668 Boolean cur_isdefault = rs.getInt(CUR_ISDEFAULT) == 1; 669 if(rs.wasNull()) 670 cur_isdefault = null; 671 672 Integer cur_sortorder = rs.getInt(CUR_SORTORDER); 673 if(rs.wasNull()) 674 cur_sortorder = null; 675 676 CurrencyValue _value = new CurrencyValue(_pk, cur_currencyisoname, cur_symbol, cur_sympos_symbolpositionid == null? null: new SymbolPositionPK(cur_sympos_symbolpositionid), cur_symbolonliststart, cur_symbolonlistmember, cur_symbolonsubtotal, cur_symbolontotal, cur_groupingseparator, cur_groupingsize, cur_fractionseparator, cur_defaultfractiondigits, cur_priceunitfractiondigits, cur_pricelinefractiondigits, cur_costunitfractiondigits, cur_costlinefractiondigits, cur_minussign, cur_isdefault, cur_sortorder); 677 _entity = new Currency(_value, entityPermission); 678 } 679 680 if(!foundInSessionCache) { 681 if(entityPermission.equals(EntityPermission.READ_ONLY)) { 682 session.putReadOnlyEntity(_pk, _entity); 683 session.getValueCache().put(_entity.getCurrencyValue()); 684 } else { 685 session.putReadWriteEntity(_pk, _entity); 686 } 687 } 688 } catch (SQLException se) { 689 throw new PersistenceDatabaseException(se); 690 } 691 692 return _entity; 693 } 694 695 public Currency create(String currencyIsoName, String symbol, SymbolPosition symbolPosition, Boolean symbolOnListStart, Boolean symbolOnListMember, Boolean symbolOnSubtotal, Boolean symbolOnTotal, String groupingSeparator, Integer groupingSize, String fractionSeparator, Integer defaultFractionDigits, Integer priceUnitFractionDigits, Integer priceLineFractionDigits, Integer costUnitFractionDigits, Integer costLineFractionDigits, String minusSign, Boolean isDefault, Integer sortOrder) 696 throws PersistenceDatabaseException, PersistenceNotNullException { 697 return create(currencyIsoName, symbol, symbolPosition == null ? null : symbolPosition.getPrimaryKey(), symbolOnListStart, symbolOnListMember, symbolOnSubtotal, symbolOnTotal, groupingSeparator, groupingSize, fractionSeparator, defaultFractionDigits, priceUnitFractionDigits, priceLineFractionDigits, costUnitFractionDigits, costLineFractionDigits, minusSign, isDefault, sortOrder); 698 } 699 700 private void bindForCreate(PreparedStatement _ps, CurrencyValue _value) 701 throws SQLException { 702 _ps.setLong(1, _value.getEntityId()); 703 704 String cur_currencyisoname = _value.getCurrencyIsoName(); 705 if(cur_currencyisoname == null) 706 _ps.setNull(2, Types.VARCHAR); 707 else 708 _ps.setString(2, cur_currencyisoname); 709 710 String cur_symbol = _value.getSymbol(); 711 if(cur_symbol == null) 712 _ps.setNull(3, Types.VARCHAR); 713 else 714 _ps.setString(3, cur_symbol); 715 716 SymbolPositionPK cur_sympos_symbolpositionid = _value.getSymbolPositionPK(); 717 if(cur_sympos_symbolpositionid == null) 718 _ps.setNull(4, Types.BIGINT); 719 else 720 _ps.setLong(4, cur_sympos_symbolpositionid.getEntityId()); 721 722 Boolean cur_symbolonliststart = _value.getSymbolOnListStart(); 723 if(cur_symbolonliststart == null) 724 _ps.setNull(5, Types.BIT); 725 else 726 _ps.setInt(5, cur_symbolonliststart? 1: 0); 727 728 Boolean cur_symbolonlistmember = _value.getSymbolOnListMember(); 729 if(cur_symbolonlistmember == null) 730 _ps.setNull(6, Types.BIT); 731 else 732 _ps.setInt(6, cur_symbolonlistmember? 1: 0); 733 734 Boolean cur_symbolonsubtotal = _value.getSymbolOnSubtotal(); 735 if(cur_symbolonsubtotal == null) 736 _ps.setNull(7, Types.BIT); 737 else 738 _ps.setInt(7, cur_symbolonsubtotal? 1: 0); 739 740 Boolean cur_symbolontotal = _value.getSymbolOnTotal(); 741 if(cur_symbolontotal == null) 742 _ps.setNull(8, Types.BIT); 743 else 744 _ps.setInt(8, cur_symbolontotal? 1: 0); 745 746 String cur_groupingseparator = _value.getGroupingSeparator(); 747 if(cur_groupingseparator == null) 748 _ps.setNull(9, Types.VARCHAR); 749 else 750 _ps.setString(9, cur_groupingseparator); 751 752 Integer cur_groupingsize = _value.getGroupingSize(); 753 if(cur_groupingsize == null) 754 _ps.setNull(10, Types.INTEGER); 755 else 756 _ps.setInt(10, cur_groupingsize); 757 758 String cur_fractionseparator = _value.getFractionSeparator(); 759 if(cur_fractionseparator == null) 760 _ps.setNull(11, Types.VARCHAR); 761 else 762 _ps.setString(11, cur_fractionseparator); 763 764 Integer cur_defaultfractiondigits = _value.getDefaultFractionDigits(); 765 if(cur_defaultfractiondigits == null) 766 _ps.setNull(12, Types.INTEGER); 767 else 768 _ps.setInt(12, cur_defaultfractiondigits); 769 770 Integer cur_priceunitfractiondigits = _value.getPriceUnitFractionDigits(); 771 if(cur_priceunitfractiondigits == null) 772 _ps.setNull(13, Types.INTEGER); 773 else 774 _ps.setInt(13, cur_priceunitfractiondigits); 775 776 Integer cur_pricelinefractiondigits = _value.getPriceLineFractionDigits(); 777 if(cur_pricelinefractiondigits == null) 778 _ps.setNull(14, Types.INTEGER); 779 else 780 _ps.setInt(14, cur_pricelinefractiondigits); 781 782 Integer cur_costunitfractiondigits = _value.getCostUnitFractionDigits(); 783 if(cur_costunitfractiondigits == null) 784 _ps.setNull(15, Types.INTEGER); 785 else 786 _ps.setInt(15, cur_costunitfractiondigits); 787 788 Integer cur_costlinefractiondigits = _value.getCostLineFractionDigits(); 789 if(cur_costlinefractiondigits == null) 790 _ps.setNull(16, Types.INTEGER); 791 else 792 _ps.setInt(16, cur_costlinefractiondigits); 793 794 String cur_minussign = _value.getMinusSign(); 795 if(cur_minussign == null) 796 _ps.setNull(17, Types.VARCHAR); 797 else 798 _ps.setString(17, cur_minussign); 799 800 Boolean cur_isdefault = _value.getIsDefault(); 801 if(cur_isdefault == null) 802 _ps.setNull(18, Types.BIT); 803 else 804 _ps.setInt(18, cur_isdefault? 1: 0); 805 806 Integer cur_sortorder = _value.getSortOrder(); 807 if(cur_sortorder == null) 808 _ps.setNull(19, Types.INTEGER); 809 else 810 _ps.setInt(19, cur_sortorder); 811 812 } 813 814 public Currency create(String currencyIsoName, String symbol, SymbolPositionPK symbolPositionPK, Boolean symbolOnListStart, Boolean symbolOnListMember, Boolean symbolOnSubtotal, Boolean symbolOnTotal, String groupingSeparator, Integer groupingSize, String fractionSeparator, Integer defaultFractionDigits, Integer priceUnitFractionDigits, Integer priceLineFractionDigits, Integer costUnitFractionDigits, Integer costLineFractionDigits, String minusSign, Boolean isDefault, Integer sortOrder) 815 throws PersistenceDatabaseException, PersistenceNotNullException { 816 CurrencyPK _pk = getNextPK(); 817 CurrencyValue _value = new CurrencyValue(_pk, currencyIsoName, symbol, symbolPositionPK, symbolOnListStart, symbolOnListMember, symbolOnSubtotal, symbolOnTotal, groupingSeparator, groupingSize, fractionSeparator, defaultFractionDigits, priceUnitFractionDigits, priceLineFractionDigits, costUnitFractionDigits, costLineFractionDigits, minusSign, isDefault, sortOrder); 818 819 PreparedStatement _ps = session.prepareStatement(SQL_INSERT); 820 821 try { 822 bindForCreate(_ps, _value); 823 824 if(PersistenceDebugFlags.CheckEntityInsertRowCount) { 825 int _count = _ps.executeUpdate(); 826 827 if(_count != 1) { 828 throw new PersistenceDatabaseUpdateException("insert failed, _count = " + _count); 829 } 830 } else { 831 _ps.executeUpdate(); 832 } 833 834 session.getValueCache().put(_value); 835 } catch (SQLException se) { 836 throw new PersistenceDatabaseException(se); 837 } 838 839 Currency _entity = new Currency(_value, EntityPermission.READ_ONLY); 840 session.putReadOnlyEntity(_pk, _entity); 841 842 return _entity; 843 } 844 845 public void create(Collection<CurrencyValue> _values) 846 throws PersistenceDatabaseException, PersistenceNotNullException { 847 int _size = _values.size(); 848 849 if(_size > 0) { 850 PreparedStatement _ps = session.prepareStatement(SQL_INSERT); 851 List<CurrencyValue> _cacheValues = new ArrayList<>(_size); 852 853 try { 854 for(CurrencyValue _value : _values) { 855 _value.setEntityId(entityIdGenerator.getNextEntityId()); 856 bindForCreate(_ps, _value); 857 858 _ps.addBatch(); 859 860 _cacheValues.add(_value); 861 } 862 863 if(PersistenceDebugFlags.CheckEntityInsertRowCount) { 864 int[] _counts = _ps.executeBatch(); 865 866 for(int _countOffset = 0 ; _countOffset < _size ; _countOffset++) { 867 if(_counts[_countOffset] != 1 && _counts[_countOffset] != PreparedStatement.SUCCESS_NO_INFO) { 868 throw new PersistenceDatabaseUpdateException("batch insert failed, _counts[" + _countOffset + "] = " + _counts[_countOffset]); 869 } 870 } 871 } else { 872 _ps.executeBatch(); 873 } 874 875 _ps.clearBatch(); 876 } catch (SQLException se) { 877 throw new PersistenceDatabaseException(se); 878 } 879 880 _cacheValues.forEach((_cacheValue) -> { 881 Currency _cacheEntity = new Currency(_cacheValue, EntityPermission.READ_ONLY); 882 883 session.putReadOnlyEntity(_cacheValue.getPrimaryKey(), _cacheEntity); 884 }); 885 } 886 } 887 888 private boolean bindForStore(PreparedStatement _ps, CurrencyValue _value) 889 throws SQLException { 890 boolean _hasBeenModified = _value.hasBeenModified(); 891 892 if(_hasBeenModified) { 893 String cur_currencyisoname = _value.getCurrencyIsoName(); 894 if(cur_currencyisoname == null) 895 _ps.setNull(1, Types.VARCHAR); 896 else 897 _ps.setString(1, cur_currencyisoname); 898 899 String cur_symbol = _value.getSymbol(); 900 if(cur_symbol == null) 901 _ps.setNull(2, Types.VARCHAR); 902 else 903 _ps.setString(2, cur_symbol); 904 905 SymbolPositionPK cur_sympos_symbolpositionid = _value.getSymbolPositionPK(); 906 if(cur_sympos_symbolpositionid == null) 907 _ps.setNull(3, Types.BIGINT); 908 else 909 _ps.setLong(3, cur_sympos_symbolpositionid.getEntityId()); 910 911 Boolean cur_symbolonliststart = _value.getSymbolOnListStart(); 912 if(cur_symbolonliststart == null) 913 _ps.setNull(4, Types.BIT); 914 else 915 _ps.setInt(4, cur_symbolonliststart? 1: 0); 916 917 Boolean cur_symbolonlistmember = _value.getSymbolOnListMember(); 918 if(cur_symbolonlistmember == null) 919 _ps.setNull(5, Types.BIT); 920 else 921 _ps.setInt(5, cur_symbolonlistmember? 1: 0); 922 923 Boolean cur_symbolonsubtotal = _value.getSymbolOnSubtotal(); 924 if(cur_symbolonsubtotal == null) 925 _ps.setNull(6, Types.BIT); 926 else 927 _ps.setInt(6, cur_symbolonsubtotal? 1: 0); 928 929 Boolean cur_symbolontotal = _value.getSymbolOnTotal(); 930 if(cur_symbolontotal == null) 931 _ps.setNull(7, Types.BIT); 932 else 933 _ps.setInt(7, cur_symbolontotal? 1: 0); 934 935 String cur_groupingseparator = _value.getGroupingSeparator(); 936 if(cur_groupingseparator == null) 937 _ps.setNull(8, Types.VARCHAR); 938 else 939 _ps.setString(8, cur_groupingseparator); 940 941 Integer cur_groupingsize = _value.getGroupingSize(); 942 if(cur_groupingsize == null) 943 _ps.setNull(9, Types.INTEGER); 944 else 945 _ps.setInt(9, cur_groupingsize); 946 947 String cur_fractionseparator = _value.getFractionSeparator(); 948 if(cur_fractionseparator == null) 949 _ps.setNull(10, Types.VARCHAR); 950 else 951 _ps.setString(10, cur_fractionseparator); 952 953 Integer cur_defaultfractiondigits = _value.getDefaultFractionDigits(); 954 if(cur_defaultfractiondigits == null) 955 _ps.setNull(11, Types.INTEGER); 956 else 957 _ps.setInt(11, cur_defaultfractiondigits); 958 959 Integer cur_priceunitfractiondigits = _value.getPriceUnitFractionDigits(); 960 if(cur_priceunitfractiondigits == null) 961 _ps.setNull(12, Types.INTEGER); 962 else 963 _ps.setInt(12, cur_priceunitfractiondigits); 964 965 Integer cur_pricelinefractiondigits = _value.getPriceLineFractionDigits(); 966 if(cur_pricelinefractiondigits == null) 967 _ps.setNull(13, Types.INTEGER); 968 else 969 _ps.setInt(13, cur_pricelinefractiondigits); 970 971 Integer cur_costunitfractiondigits = _value.getCostUnitFractionDigits(); 972 if(cur_costunitfractiondigits == null) 973 _ps.setNull(14, Types.INTEGER); 974 else 975 _ps.setInt(14, cur_costunitfractiondigits); 976 977 Integer cur_costlinefractiondigits = _value.getCostLineFractionDigits(); 978 if(cur_costlinefractiondigits == null) 979 _ps.setNull(15, Types.INTEGER); 980 else 981 _ps.setInt(15, cur_costlinefractiondigits); 982 983 String cur_minussign = _value.getMinusSign(); 984 if(cur_minussign == null) 985 _ps.setNull(16, Types.VARCHAR); 986 else 987 _ps.setString(16, cur_minussign); 988 989 Boolean cur_isdefault = _value.getIsDefault(); 990 if(cur_isdefault == null) 991 _ps.setNull(17, Types.BIT); 992 else 993 _ps.setInt(17, cur_isdefault? 1: 0); 994 995 Integer cur_sortorder = _value.getSortOrder(); 996 if(cur_sortorder == null) 997 _ps.setNull(18, Types.INTEGER); 998 else 999 _ps.setInt(18, cur_sortorder); 1000 1001 _ps.setLong(19, _value.getPrimaryKey().getEntityId()); 1002 1003 _value.clearHasBeenModified(); 1004 } 1005 1006 return _hasBeenModified; 1007 } 1008 1009 @Override 1010 public void store(Currency entity) 1011 throws PersistenceDatabaseException { 1012 PreparedStatement _ps = session.prepareStatement(SQL_UPDATE); 1013 1014 try { 1015 CurrencyValue _value = entity.getCurrencyValue(); 1016 1017 if(bindForStore(_ps, _value)) { 1018 if(PersistenceDebugFlags.CheckEntityUpdateRowCount) { 1019 int _count = _ps.executeUpdate(); 1020 1021 if(_count != 1) { 1022 throw new PersistenceDatabaseUpdateException("update failed, _count = " + _count); 1023 } 1024 } else { 1025 _ps.executeUpdate(); 1026 } 1027 1028 session.getValueCache().put(_value); 1029 } 1030 } catch (SQLException se) { 1031 throw new PersistenceDatabaseException(se); 1032 } 1033 } 1034 1035 @Override 1036 public void store(Collection<Currency> entities) 1037 throws PersistenceDatabaseException { 1038 if(entities.size() > 0) { 1039 PreparedStatement _ps = session.prepareStatement(SQL_UPDATE); 1040 int _modifiedEntities = 0; 1041 1042 try { 1043 for(Currency entity : entities) { 1044 if(bindForStore(_ps, entity.getCurrencyValue())) { 1045 _ps.addBatch(); 1046 _modifiedEntities++; 1047 } 1048 } 1049 1050 if(_modifiedEntities != 0) { 1051 if(PersistenceDebugFlags.CheckEntityUpdateRowCount) { 1052 int[] _counts = _ps.executeBatch(); 1053 1054 for(int _countOffset = 0 ; _countOffset < _modifiedEntities ; _countOffset++) { 1055 if(_counts[_countOffset] != 1 && _counts[_countOffset] != PreparedStatement.SUCCESS_NO_INFO) { 1056 throw new PersistenceDatabaseUpdateException("batch update failed, _counts[" + _countOffset + "] = " + _counts[_countOffset]); 1057 } 1058 } 1059 } else { 1060 _ps.executeBatch(); 1061 } 1062 1063 _ps.clearBatch(); 1064 1065 entities.forEach((entity) -> { 1066 session.getValueCache().put(entity.getCurrencyValue()); 1067 }); 1068 } 1069 } catch (SQLException se) { 1070 throw new PersistenceDatabaseException(se); 1071 } 1072 } 1073 } 1074 1075 @Override 1076 public void remove(Currency entity) 1077 throws PersistenceDatabaseException { 1078 remove(entity.getPrimaryKey()); 1079 } 1080 1081 @Override 1082 public void remove(CurrencyPK pk) 1083 throws PersistenceDatabaseException { 1084 PreparedStatement _ps = session.prepareStatement(SQL_DELETE); 1085 long _entityId = pk.getEntityId(); 1086 1087 try { 1088 _ps.setLong(1, _entityId); 1089 1090 if(PersistenceDebugFlags.CheckEntityDeleteRowCount) { 1091 int _count = _ps.executeUpdate(); 1092 1093 if(_count != 1) { 1094 throw new PersistenceDatabaseUpdateException("remove failed, _count = " + _count); 1095 } 1096 } else { 1097 _ps.executeUpdate(); 1098 } 1099 1100 session.getValueCache().remove(pk); 1101 } catch (SQLException se) { 1102 throw new PersistenceDatabaseException(se); 1103 } 1104 1105 session.removed(pk, false); 1106 } 1107 1108 @Override 1109 public void remove(Collection<CurrencyPK> pks) 1110 throws PersistenceDatabaseException { 1111 if(pks.size() > 0) { 1112 PreparedStatement _ps = session.prepareStatement(SQL_DELETE); 1113 int _modifiedEntities = 0; 1114 1115 try { 1116 for(CurrencyPK pk : pks) { 1117 long _entityId = pk.getEntityId(); 1118 1119 _ps.setLong(1, _entityId); 1120 1121 _ps.addBatch(); 1122 _modifiedEntities++; 1123 } 1124 1125 if(_modifiedEntities != 0) { 1126 if(PersistenceDebugFlags.CheckEntityDeleteRowCount) { 1127 int[] _counts = _ps.executeBatch(); 1128 1129 for(int _countOffset = 0 ; _countOffset < _modifiedEntities ; _countOffset++) { 1130 if(_counts[_countOffset] != 1 && _counts[_countOffset] != PreparedStatement.SUCCESS_NO_INFO) { 1131 throw new PersistenceDatabaseUpdateException("batch remove failed, _counts[" + _countOffset + "] = " + _counts[_countOffset]); 1132 } 1133 } 1134 } else { 1135 _ps.executeBatch(); 1136 } 1137 1138 _ps.clearBatch(); 1139 1140 pks.forEach((pk) -> { 1141 session.getValueCache().remove(pk); 1142 }); 1143 } 1144 } catch (SQLException se) { 1145 throw new PersistenceDatabaseException(se); 1146 } 1147 1148 pks.forEach((pk) -> { 1149 session.removed(pk, true); 1150 }); 1151 } 1152 } 1153 1154 @Override 1155 public boolean validPK(CurrencyPK pk) 1156 throws PersistenceDatabaseException { 1157 boolean valid = false; 1158 PreparedStatement _ps = session.prepareStatement(SQL_VALID); 1159 ResultSet _rs = null; 1160 1161 try { 1162 _ps.setLong(1, pk.getEntityId()); 1163 1164 _rs = _ps.executeQuery(); 1165 if(_rs.next()) { 1166 long _count = _rs.getLong(1); 1167 if(_rs.wasNull()) 1168 _count = 0; 1169 1170 if(_count == 1) 1171 valid = true; 1172 } 1173 } catch (SQLException se) { 1174 throw new PersistenceDatabaseException(se); 1175 } finally { 1176 if(_rs != null) { 1177 try { 1178 _rs.close(); 1179 } catch (SQLException se) { 1180 // do nothing 1181 } 1182 } 1183 } 1184 1185 return valid; 1186 } 1187 1188}