当前位置: 首页>>代码示例>>Java>>正文


Java Persistence类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:TestCascadingEntityListener.java

示例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);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:16,代码来源:TestContainer.java

示例3: TrustedClientAuthenticationProvider

import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
@Inject
public TrustedClientAuthenticationProvider(Persistence persistence, Messages messages) {
    super(persistence, messages);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:5,代码来源:TrustedClientAuthenticationProvider.java

示例4: AnonymousAuthenticationProvider

import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
@Inject
public AnonymousAuthenticationProvider(Persistence persistence, Messages messages) {
    super(persistence, messages);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:5,代码来源:AnonymousAuthenticationProvider.java

示例5: AbstractAuthenticationProvider

import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
public AbstractAuthenticationProvider(Persistence persistence, Messages messages) {
    this.persistence = persistence;
    this.messages = messages;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:5,代码来源:AbstractAuthenticationProvider.java

示例6: LoginPasswordAuthenticationProvider

import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
@Inject
public LoginPasswordAuthenticationProvider(Persistence persistence, Messages messages) {
    super(persistence, messages);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:5,代码来源:LoginPasswordAuthenticationProvider.java

示例7: SystemAuthenticationProvider

import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
@Inject
public SystemAuthenticationProvider(Persistence persistence, Messages messages) {
    super(persistence, messages);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:5,代码来源:SystemAuthenticationProvider.java

示例8: RememberMeAuthenticationProvider

import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
@Inject
public RememberMeAuthenticationProvider(Persistence persistence, Messages messages) {
    super(persistence, messages);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:5,代码来源:RememberMeAuthenticationProvider.java

示例9: setPersistence

import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
public void setPersistence(Persistence persistence) {
    this.persistence = persistence;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:4,代码来源:TransactionalInterceptor.java

示例10: persistence

import com.haulmont.cuba.core.Persistence; //导入依赖的package包/类
public Persistence persistence() {
    return AppBeans.get(Persistence.class);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:4,代码来源:TestContainer.java


注:本文中的com.haulmont.cuba.core.Persistence类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。