List of usage examples for org.hibernate FetchMode SELECT
FetchMode SELECT
To view the source code for org.hibernate FetchMode SELECT.
Click Source Link
From source file:eu.ist_phosphorus.harmony.idb.database.hibernate.Service.java
License:Open Source License
/** * load services from DB which contain the user service-ID NOT the * primary-key. Therefore we also need the corresponding reservationID to * make this unique./*from www . j a va 2s . c o m*/ * * @param session */ @SuppressWarnings("unchecked") public static final List<Service> loadWithUserID(int serviceUserId, Reservation res) throws DatabaseException { return (List<Service>) (new TransactionManager( new Tuple<Integer, Reservation>(new Integer(serviceUserId), res)) { @Override protected void dbOperation() { Tuple<Integer, Reservation> args = (Tuple<Integer, Reservation>) this.arg; this.result = this.session.createCriteria(Service.class).setFetchMode("", FetchMode.SELECT) .add(Restrictions.like("serviceId", args.getFirstElement())) .add(Restrictions.like("reservation", args.getSecondElement())).list(); } }).getResult(); }
From source file:eu.ist_phosphorus.harmony.idb.database.hibernate.Service.java
License:Open Source License
/** * Load Connections from the DB. This will override all stored connections!! *//*from w ww . j a v a 2 s. c o m*/ @SuppressWarnings("unchecked") public final void loadConnections() throws DatabaseException { List<Connections> tmpConns = (List<Connections>) (new TransactionManager(new Long(this.PK_service)) { @Override protected void dbOperation() { this.result = this.session.createCriteria(Connections.class).setFetchMode("", FetchMode.SELECT) .add(Restrictions.like("fkService", this.arg)).list(); } }).getResult(); // clear all old connections this.connections.clear(); // put new connections from DB into the set for (Connections connections : tmpConns) { this.connections.put(new Integer(connections.getConnectionId()), connections); } }
From source file:eu.ist_phosphorus.harmony.idb.database.hibernate.Subscription.java
License:Open Source License
@SuppressWarnings("unchecked") @Transient/* ww w. ja va 2 s . co m*/ public static final List<Subscription> getSubscriptionsForTopic(String topic) throws DatabaseException { return (List<Subscription>) (new TransactionManager(topic) { @Override protected void dbOperation() { this.result = this.session.createCriteria(Subscription.class).setFetchMode("", FetchMode.SELECT) .add(Restrictions.like("subscriptionTopic", this.arg)).list(); } }).getResult(); }
From source file:eu.ist_phosphorus.harmony.idb.database.hibernate.Subscription.java
License:Open Source License
@SuppressWarnings("unchecked") @Transient//from ww w . ja va 2 s . com public static final Subscription getSubscriptionForTopicAndEPR(String topic, String epr) throws DatabaseException { return (Subscription) (new TransactionManager(new Tuple<String, String>(topic, epr)) { @Override protected void dbOperation() { Tuple<String, String> subscribe = (Tuple<String, String>) this.arg; final List<Subscription> tmpSub = this.session.createCriteria(Subscription.class) .setFetchMode("", FetchMode.SELECT) .add(Restrictions.like("subscriptionTopic", subscribe.getFirstElement())) .add(Restrictions.like("subscriptionEPR", subscribe.getSecondElement())).list(); if (tmpSub.size() > 0) { this.result = tmpSub.get(0); } } }).getResult(); }
From source file:eu.ist_phosphorus.harmony.idb.database.hibernate.Subscription.java
License:Open Source License
@SuppressWarnings("unchecked") @Transient/*from w ww . j a va 2s. c om*/ public static final List<String> getAllTopics() throws DatabaseException { List<Subscription> tmpSubscriptions = (List<Subscription>) (new TransactionManager() { @Override protected void dbOperation() { this.result = this.session.createCriteria(Subscription.class).setFetchMode("", FetchMode.SELECT) .list(); } }).getResult(); List<String> result = new ArrayList<String>(); for (Subscription sub : tmpSubscriptions) { if (!result.contains(sub.getSubscriptionTopic())) { result.add(sub.getSubscriptionTopic()); } } return result; }
From source file:eu.ist_phosphorus.harmony.idb.database.hibernate.Subscription.java
License:Open Source License
@SuppressWarnings("unchecked") @Transient//from w w w . j a va 2s.co m public static final List<Subscription> getAllSubscriptions() throws DatabaseException { return (List<Subscription>) (new TransactionManager() { @Override protected void dbOperation() { this.result = this.session.createCriteria(Subscription.class).setFetchMode("", FetchMode.SELECT) .list(); } }).getResult(); }
From source file:eu.ist_phosphorus.harmony.idb.database.hibernate.TNAPrefix.java
License:Open Source License
@SuppressWarnings("unchecked") public static Set<TNAPrefix> loadAll() throws DatabaseException { return (Set<TNAPrefix>) (new TransactionManager() { @Override// w w w. j av a2 s . co m protected void dbOperation() { Set<TNAPrefix> result = new HashSet<TNAPrefix>(); final List<TNAPrefix> tmpPrefix = this.session.createCriteria(TNAPrefix.class) .setFetchMode("TNAPrefix", FetchMode.SELECT).list(); for (TNAPrefix d : tmpPrefix) { result.add(d); } this.result = result; } }).getResult(); }
From source file:eu.ist_phosphorus.harmony.idb.database.hibernate.VIEW_DomainReservationMappingPK.java
License:Open Source License
@Transient @SuppressWarnings("unchecked") public static final List<VIEW_DomainReservationMapping> getMappingsForDomain(final String domName) throws DatabaseException { final List<VIEW_DomainReservationMapping> mappings = (List<VIEW_DomainReservationMapping>) (new TransactionManager( domName) {/*w ww . j ava 2s .c om*/ @Override protected void dbOperation() { this.result = this.session.createCriteria(VIEW_DomainReservationMapping.class) .setFetchMode("", FetchMode.SELECT).add(Restrictions.like("domainName", this.arg)).list(); } }).getResult(); return mappings; }
From source file:eu.ist_phosphorus.harmony.idb.database.hibernate.VIEW_InterDomainLink.java
License:Open Source License
@SuppressWarnings("unchecked") public static final Set<VIEW_InterDomainLink> loadAll() throws DatabaseException { return (Set<VIEW_InterDomainLink>) (new TransactionManager() { @Override//w ww .j a v a 2s . c om protected void dbOperation() { Set<VIEW_InterDomainLink> result = new HashSet<VIEW_InterDomainLink>(); final List<VIEW_InterDomainLink> tmpLink = this.session.createCriteria(VIEW_InterDomainLink.class) .setFetchMode("Link", FetchMode.SELECT).list(); for (VIEW_InterDomainLink l : tmpLink) { result.add(l); } this.result = result; } }).getResult(); }
From source file:eu.ist_phosphorus.harmony.idb.database.hibernate.VIEW_InterDomainLink.java
License:Open Source License
/** * Load link from the DB./*from w w w . j a va 2 s .c o m*/ */ @SuppressWarnings("unchecked") public static final VIEW_InterDomainLink load(Endpoint source, Endpoint dest) throws DatabaseException { return (VIEW_InterDomainLink) (new TransactionManager(new Tuple<Endpoint, Endpoint>(source, dest)) { @Override protected void dbOperation() { Tuple<Endpoint, Endpoint> ep = (Tuple<Endpoint, Endpoint>) this.arg; final List<VIEW_InterDomainLink> tmpLink = this.session.createCriteria(VIEW_InterDomainLink.class) .setFetchMode("", FetchMode.SELECT) .add(Restrictions.like("sourceEndpoint", ep.getFirstElement())) .add(Restrictions.like("destEndpoint", ep.getSecondElement())).list(); if (tmpLink.size() > 0) { this.result = tmpLink.get(0); } } }).getResult(); }