本文整理汇总了Java中org.hibernate.Hibernate.initialize方法的典型用法代码示例。如果您正苦于以下问题:Java Hibernate.initialize方法的具体用法?Java Hibernate.initialize怎么用?Java Hibernate.initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.Hibernate
的用法示例。
在下文中一共展示了Hibernate.initialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getComparisonInitialiserForStopEdit
import org.hibernate.Hibernate; //导入方法依赖的package包/类
@Override
protected ComparisonEntityInitialiser<ItemDefinition> getComparisonInitialiserForStopEdit()
{
return new ComparisonEntityInitialiser<ItemDefinition>()
{
@Override
public void preUnlink(ItemDefinition t)
{
// We suck the big one for misusing hibernate.
initBundle(t.getName());
initBundle(t.getDescription());
t.getItemMetadataRules();
Hibernate.initialize(t.getWorkflow());
}
};
}
示例2: findBySSO
import org.hibernate.Hibernate; //导入方法依赖的package包/类
public AdmUser findBySSO(String email) {
logger.info("email : {}", email);
Criteria crit = createEntityCriteria();
crit.add(Restrictions.eq("email", email));
AdmUser user = (AdmUser) crit.uniqueResult();
if (user != null) {
Hibernate.initialize(user.getUserRoles());
}
return user;
}
示例3: removeProduct
import org.hibernate.Hibernate; //导入方法依赖的package包/类
/**
* Remove a product from a collection. The product should stay in the
* database.
*
* @param cid the collection id where remove product.
* @param pid the product id to remove.
* @param user unused parameter.
*/
public void removeProduct (final String cid, final Long pid, User user)
{
Collection collection = read(cid);
if (collection == null)
{
LOGGER.warn("Unknown collection #" + cid);
return;
}
Product product = productDao.read(pid);
if (product == null)
{
LOGGER.warn("Unknown product #" + pid);
return;
}
Hibernate.initialize (collection.getProducts());
collection.getProducts().remove(product);
update(collection);
fireProductRemoved (new DaoEvent<> (collection), product);
}
示例4: delete
import org.hibernate.Hibernate; //导入方法依赖的package包/类
@Override
@Test (dependsOnMethods = { "read", "create" })
public void delete ()
{
long id = 1;
Eviction eviction = dao.read (id);
Set<Product> ps = eviction.getProducts ();
Hibernate.initialize (ps);
dao.delete (eviction);
assertEquals (dao.count (), (howMany () - 1));
assertNull (dao.read (id));
for (Product p : ps)
{
assertNotNull (pdao.read (p.getId ()));
}
}
示例5: unproxyEntity
import org.hibernate.Hibernate; //导入方法依赖的package包/类
protected <T> T unproxyEntity(T template) {
if (template instanceof HibernateProxy) {
Hibernate.initialize(template);
template = (T) ((HibernateProxy) template)
.getHibernateLazyInitializer()
.getImplementation();
}
return template;
}
示例6: handleGetClientLogo
import org.hibernate.Hibernate; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*
* @see com.communote.server.core.ConfigurationManagementBase#handleGetClientLogo()
*/
@Override
protected ImageVO handleGetClientLogo() {
Configuration configuration = handleGetConfiguration();
ImageVO result = null;
ClientConfiguration clientConfig = configuration.getClientConfig();
if (clientConfig != null) {
if (!Hibernate.isInitialized(clientConfig.getLogoImage())) {
Hibernate.initialize(clientConfig.getLogoImage());
}
if (clientConfig.getLogoImage() != null) {
result = new ImageVO();
result.setImage(configuration.getClientConfig().getLogoImage());
Timestamp date = configuration.getClientConfig().getLastLogoImageModificationDate();
// use timestamp 0 if it is not yet set due to migration
result.setLastModificationDate(date == null ? new Date(0) : date);
}
}
return result;
}
示例7: handleGetConfiguration
import org.hibernate.Hibernate; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*
* @see com.communote.server.core.ConfigurationManagementBase#handleGetConfiguration()
*/
@Override
protected Configuration handleGetConfiguration() {
Collection<Configuration> list = getConfigurationDao().loadAll();
Configuration configuration = null;
if (list == null || list.size() == 0) {
configuration = Configuration.Factory.newInstance();
ClientConfiguration clientConfiguration = ClientConfiguration.Factory.newInstance();
configuration.setClientConfig(clientConfiguration);
getClientConfigurationDao().create(clientConfiguration);
configuration = getConfigurationDao().create(configuration);
} else {
configuration = list.iterator().next();
}
// initialize the default blog of the client
Blog defaultBlog = configuration.getClientConfig().getDefaultBlog();
if (defaultBlog != null && !Hibernate.isInitialized(defaultBlog)) {
Hibernate.initialize(defaultBlog);
}
return configuration;
}
示例8: findStudentByEmail
import org.hibernate.Hibernate; //导入方法依赖的package包/类
@Override
public StudentUser findStudentByEmail(String email) {
logger.info("email : {}", email);
Criteria crit = createEntityCriteria();
crit.add(Restrictions.eq("email", email));
StudentUser user = (StudentUser) crit.uniqueResult();
if (user != null) {
Hibernate.initialize(user.getUserRoles());
}
return user;
}
示例9: getProductWithIndexes
import org.hibernate.Hibernate; //导入方法依赖的package包/类
@Transactional (readOnly=true, propagation=Propagation.REQUIRED)
public Product getProductWithIndexes(Long product_id)
{
Product product = productDao.read (product_id);
if (product == null) return null;
Hibernate.initialize (product.getIndexes ());
return product;
}
示例10: getCartOfUser
import org.hibernate.Hibernate; //导入方法依赖的package包/类
/**
* Get the cart of the related user. If the user has no cart configured, null
* is returned.
* @param uuid the related user to retrieve the cart.
* @return the cart
* @throws UserNotExistingException when passed user is unknown.
*/
@PreAuthorize ("hasRole('ROLE_DOWNLOAD')")
@Transactional (readOnly=true, propagation=Propagation.REQUIRED)
public ProductCart getCartOfUser(String uuid) throws UserNotExistingException
{
User user = getUser (uuid);
ProductCart pc = productCartDao.getCartOfUser(user);
if (pc != null)
{
Hibernate.initialize(pc.getProducts());
}
return pc;
}
示例11: findBySSO
import org.hibernate.Hibernate; //导入方法依赖的package包/类
public User findBySSO(String sso) {
logger.info("SSO : {}", sso);
Criteria crit = createEntityCriteria();
crit.add(Restrictions.eq("ssoId", sso));
User user = (User)crit.uniqueResult();
if(user!=null){
Hibernate.initialize(user.getUserProfiles());
}
return user;
}
示例12: initBundle
import org.hibernate.Hibernate; //导入方法依赖的package包/类
protected void initBundle(LanguageBundle bundle)
{
if( bundle != null )
{
Hibernate.initialize(bundle.getStrings());
}
}
示例13: initializeUser
import org.hibernate.Hibernate; //导入方法依赖的package包/类
private User initializeUser(User u) {
Hibernate.initialize(u.getLikes());
Hibernate.initialize(u.getCommunities());
Hibernate.initialize(u.getRoles());
Hibernate.initialize(u.getUserContacts());
Hibernate.initialize(u.getPrivateMessagesReceiver());
Hibernate.initialize(u.getPrivateMessagesSender());
return u;
}
示例14: findOneWithContent
import org.hibernate.Hibernate; //导入方法依赖的package包/类
/**
* Get one attachment by id.
*
* @param id the id of the entity
* @return the entity
*/
@Transactional(readOnly = true)
public Attachment findOneWithContent(Long id) {
log.debug("Request to get Attachment : {}", id);
Attachment attachment = attachmentRepository.findOne(id);
if (attachment != null) {
Hibernate.initialize(attachment.getContent());
}
return attachment;
}
示例15: initBundle
import org.hibernate.Hibernate; //导入方法依赖的package包/类
protected void initBundle(@Nullable LanguageBundle bundle)
{
if( bundle != null )
{
Hibernate.initialize(bundle.getStrings());
}
}