本文整理了Java中com.avaje.ebean.Ebean.getServer()
方法的一些代码示例,展示了Ebean.getServer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ebean.getServer()
方法的具体详情如下:
包路径:com.avaje.ebean.Ebean
类名称:Ebean
方法名:getServer
[英]Get the EbeanServer for a given DataSource. If name is null this will return the 'default' EbeanServer.
This is provided to access EbeanServer for databases other than the 'default' database. EbeanServer also provides more control over transactions and the ability to use transactions created externally to Ebean.
// use the "hr" database
[中]获取给定数据源的EbeanServer。如果name为null,则返回“默认”EbeanServer。
提供此选项是为了访问除“默认”数据库之外的其他数据库的EbeanServer。EbeanServer还提供了对事务的更多控制,并能够使用在Ebean外部创建的事务。
// use the "hr" database
代码示例来源:origin: org.avaje.ebean/ebean
/**
* 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);
}
代码示例来源:origin: org.avaje.ebean/ebean
/**
* 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);
}
代码示例来源:origin: org.avaje.ebean/ebean
/**
* 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);
}
代码示例来源:origin: com.typesafe.play/play-java-ebean
private EbeanServer server() {
return Ebean.getServer(serverName);
}
代码示例来源:origin: com.typesafe.play/play-java-ebean
/**
* 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);
}
代码示例来源:origin: com.typesafe.play/play-java-ebean
/**
* Saves (inserts) this entity.
*
* @param server the Ebean server to use
*/
public void save(String server) {
Ebean.getServer(server).save(this);
}
代码示例来源:origin: com.typesafe.play/play-java-ebean
/**
* 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);
}
代码示例来源:origin: com.typesafe.play/play-java-ebean
/**
* 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);
}
代码示例来源:origin: com.typesafe.play/play-java-ebean
/**
* 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);
}
代码示例来源:origin: org.avaje.ebeanorm/avaje-ebeanorm-server
/**
* 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();
}
}
代码示例来源:origin: org.avaje.ebeanorm/avaje-ebeanorm-server
/**
* 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);
}
代码示例来源:origin: com.typesafe.play/play-java-ebean
/**
* 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);
}
代码示例来源:origin: org.avaje/ebean
/**
* 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();
}
}
代码示例来源:origin: org.avaje.ebean/ebean
/**
* 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);
}
代码示例来源:origin: org.avaje/ebean
/**
* 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);
}
代码示例来源:origin: org.avaje.ebean/ebean
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();
}
代码示例来源:origin: org.avaje.ebeanorm/avaje-ebeanorm-api
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();
}
代码示例来源:origin: org.avaje/ebean
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();
}
代码示例来源:origin: org.avaje/ebean
/**
* 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);
}
}
代码示例来源:origin: org.avaje.ebean/ebean
/**
* 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);
}
}
内容来源于网络,如有侵权,请联系作者删除!