本文整理汇总了Java中com.haulmont.cuba.core.Persistence类的典型用法代码示例。如果您正苦于以下问题:Java Persistence类的具体用法?Java Persistence怎么用?Java Persistence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Persistence类属于com.haulmont.cuba.core包,在下文中一共展示了Persistence类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBeforeUpdate
import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
@Override
public void onBeforeUpdate(User entity, EntityManager entityManager) {
events.add("onBeforeUpdate: " + entity.getId());
Transaction.Runnable code = (em) -> {
TypedQuery<User> query = entityManager.createQuery("select u from sec$User u where u.login = 'admin'", User.class);
if (withView) {
query.setViewName(View.MINIMAL);
}
User admin = query.getSingleResult();
System.out.println(admin.getLogin());
};
if (withNewTx) {
AppBeans.get(Persistence.class).runInTransaction(code);
} else {
code.run(entityManager);
}
}
示例2: after
import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
@Override
protected void after() {
log.info("Stopping test container " + this);
try {
((PersistenceImpl) AppBeans.get(Persistence.class)).dispose();
((ConfigurableApplicationContext) AppContext.getApplicationContext()).close();
TestContext.getInstance().unbind(AppContext.getProperty("cuba.dataSourceJndiName"));
AppContext.Internals.setApplicationContext(null);
for (String name : AppContext.getPropertyNames()) {
AppContext.setProperty(name, null);
}
} catch (Exception e) {
log.warn("Error closing test container", e);
}
}
示例3: TrustedClientAuthenticationProvider
import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
@Inject
public TrustedClientAuthenticationProvider(Persistence persistence, Messages messages) {
super(persistence, messages);
}
示例4: AnonymousAuthenticationProvider
import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
@Inject
public AnonymousAuthenticationProvider(Persistence persistence, Messages messages) {
super(persistence, messages);
}
示例5: AbstractAuthenticationProvider
import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
public AbstractAuthenticationProvider(Persistence persistence, Messages messages) {
this.persistence = persistence;
this.messages = messages;
}
示例6: LoginPasswordAuthenticationProvider
import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
@Inject
public LoginPasswordAuthenticationProvider(Persistence persistence, Messages messages) {
super(persistence, messages);
}
示例7: SystemAuthenticationProvider
import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
@Inject
public SystemAuthenticationProvider(Persistence persistence, Messages messages) {
super(persistence, messages);
}
示例8: RememberMeAuthenticationProvider
import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
@Inject
public RememberMeAuthenticationProvider(Persistence persistence, Messages messages) {
super(persistence, messages);
}
示例9: setPersistence
import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
public void setPersistence(Persistence persistence) {
this.persistence = persistence;
}
示例10: persistence
import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
public Persistence persistence() {
return AppBeans.get(Persistence.class);
}