/** * Return typically a different EbeanServer to the default. * <p> * This is equivalent to {@link Ebean#getServer(String)} * * @param server The name of the EbeanServer. If this is null then the default EbeanServer is * returned. */ public EbeanServer db(String server) { return Ebean.getServer(server); }
/** * Return a named EbeanServer that is typically different to the default server. * <p> * If you are using multiple databases then each database has a name and maps to a single * EbeanServer. You can use this method to get an EbeanServer for another database. * * @param server The name of the EbeanServer. If this is null then the default EbeanServer is returned. */ public static EbeanServer db(String server) { return Ebean.getServer(server); }
/** * Return the underlying 'default' EbeanServer. * <p> * This provides full access to the API such as explicit transaction demarcation etc. */ public EbeanServer db() { return Ebean.getServer(serverName); }
private EbeanServer server() { return Ebean.getServer(serverName); }
/** * Updates this entity, using a specific Ebean server. * * @param server the Ebean server to use */ public void update(String server) { Ebean.getServer(server).update(this); }
/** * Saves (inserts) this entity. * * @param server the Ebean server to use */ public void save(String server) { Ebean.getServer(server).save(this); }
/** * Deletes this entity, using a specific Ebean server. * * @param server the Ebean server to use */ public void delete(String server) { Ebean.getServer(server).delete(this); }
/** * Refreshes this entity from the database, using a specific Ebean server. * * @param server the Ebean server to use */ public void refresh(String server) { Ebean.getServer(server).refresh(this); }
/** * Persist a many-to-many association. * * @param server the Ebean server to use */ public void saveManyToManyAssociations(String server, String path) { Ebean.getServer(server).saveManyToManyAssociations(this, path); }
/** * The servlet container is starting. * <p> * Initialise the properties file using SystemProperties.initWebapp(); * and start Ebean. * </p> */ public void contextInitialized(ServletContextEvent event) { try { ServletContext servletContext = event.getServletContext(); GlobalProperties.setServletContext(servletContext); if (servletContext != null) { String servletRealPath = servletContext.getRealPath(""); GlobalProperties.put("servlet.realpath", servletRealPath); logger.info("servlet.realpath=[" + servletRealPath + "]"); } Ebean.getServer(null); } catch (Exception ex) { ex.printStackTrace(); } }
/** * Create a ScopeTrans for a given methods TxScope. */ public static ScopeTrans createScopeTrans(TxScope txScope) { EbeanServer server = Ebean.getServer(txScope.getServerName()); SpiEbeanServer iserver = (SpiEbeanServer)server; return iserver.createScopeTrans(txScope); }
/** * Updates this entity, by specifying the entity ID, using a specific Ebean server. * * @param server the Ebean server to use */ public void update(Object id, String server) { _setId(id); Ebean.getServer(server).update(this); }
/** * The servlet container is starting. * <p> * Initialise the properties file using SystemProperties.initWebapp(); * and start Ebean. * </p> */ public void contextInitialized(ServletContextEvent event) { try { ServletContext servletContext = event.getServletContext(); GlobalProperties.setServletContext(servletContext); if (servletContext != null) { String servletRealPath = servletContext.getRealPath(""); GlobalProperties.put("servlet.realpath", servletRealPath); logger.info("servlet.realpath=[" + servletRealPath + "]"); } Ebean.getServer(null); } catch (Exception ex) { ex.printStackTrace(); } }
/** * Create a ScopeTrans for a given methods TxScope. */ public static ScopeTrans createScopeTrans(TxScope txScope) { EbeanServer server = Ebean.getServer(txScope.getServerName()); SpiEbeanServer iserver = (SpiEbeanServer) server; return iserver.createScopeTrans(txScope); }
/** * Create a ScopeTrans for a given methods TxScope. */ public static ScopeTrans createScopeTrans(TxScope txScope) { EbeanServer server = Ebean.getServer(txScope.getServerName()); SpiEbeanServer iserver = (SpiEbeanServer)server; return iserver.createScopeTrans(txScope); }
void lazyLoadCollection(boolean onlyIds) { if (loader == null) { loader = (BeanCollectionLoader) Ebean.getServer(ebeanServerName); } if (loader == null) { String msg = "Lazy loading but LazyLoadEbeanServer is null?" + " The LazyLoadEbeanServer needs to be set after deserialization" + " to support lazy loading."; throw new PersistenceException(msg); } loader.loadMany(this, onlyIds); checkEmptyLazyLoad(); }
protected void lazyLoadCollection(boolean onlyIds) { if (loader == null) { loader = (BeanCollectionLoader) Ebean.getServer(ebeanServerName); } if (loader == null) { String msg = "Lazy loading but LazyLoadEbeanServer is null?" + " The LazyLoadEbeanServer needs to be set after deserialization" + " to support lazy loading."; throw new PersistenceException(msg); } loader.loadMany(this, onlyIds); checkEmptyLazyLoad(); }
protected void lazyLoadCollection(boolean onlyIds) { if (loader == null){ loader = (BeanCollectionLoader)Ebean.getServer(ebeanServerName); } if (loader == null){ String msg = "Lazy loading but LazyLoadEbeanServer is null?" +" The LazyLoadEbeanServer needs to be set after deserialization" +" to support lazy loading."; throw new PersistenceException(msg); } loader.loadMany(this, onlyIds); checkEmptyLazyLoad(); }
/** * Load the bean when it is a reference. */ protected void loadBean(String loadProperty) { synchronized (this) { if (beanLoader == null) { BeanLoader serverLoader = (BeanLoader) Ebean.getServer(ebeanServerName); if (serverLoader == null) { throw new PersistenceException("Server ["+ebeanServerName+"] was not found?"); } // For stand alone reference bean or after deserialisation lazy load // using the ebeanServer. Synchronise only on the bean. loadBeanInternal(loadProperty, serverLoader); return; } } synchronized (beanLoader) { // Lazy loading using LoadBeanContext which supports batch loading // Synchronise on the beanLoader (a 'node' of the LoadBeanContext 'tree') loadBeanInternal(loadProperty, beanLoader); } }
/** * Load the bean when it is a reference. */ protected void loadBean(int loadProperty) { synchronized (this) { if (beanLoader == null) { BeanLoader serverLoader = (BeanLoader) Ebean.getServer(ebeanServerName); if (serverLoader == null) { throw new PersistenceException("Server [" + ebeanServerName + "] was not found?"); } // For stand alone reference bean or after deserialisation lazy load // using the ebeanServer. Synchronise only on the bean. loadBeanInternal(loadProperty, serverLoader); return; } } synchronized (beanLoader) { // Lazy loading using LoadBeanContext which supports batch loading // Synchronise on the beanLoader (a 'node' of the LoadBeanContext 'tree') loadBeanInternal(loadProperty, beanLoader); } }