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


Java Hibernate.initialize方法代码示例

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

示例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;
}
 
开发者ID:mustafamym,项目名称:FeedbackCollectionAndMgmtSystem,代码行数:11,代码来源:UserDaoImpl.java

示例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);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:30,代码来源:CollectionDao.java

示例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 ()));
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:18,代码来源:TestEvictionDao.java

示例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;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:10,代码来源:EJBTestBase.java

示例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;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:25,代码来源:ConfigurationManagementImpl.java

示例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;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:28,代码来源:ConfigurationManagementImpl.java

示例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;
}
 
开发者ID:mustafamym,项目名称:FeedbackCollectionAndMgmtSystem,代码行数:12,代码来源:StudentDaoImpl.java

示例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;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:9,代码来源:ProductService.java

示例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;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:20,代码来源:ProductCartService.java

示例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;
}
 
开发者ID:TomirKlos,项目名称:Webstore,代码行数:11,代码来源:UserRepositoryImpl.java

示例12: initBundle

import org.hibernate.Hibernate; //导入方法依赖的package包/类
protected void initBundle(LanguageBundle bundle)
{
	if( bundle != null )
	{
		Hibernate.initialize(bundle.getStrings());
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:8,代码来源:AbstractIndexingExtension.java

示例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;
}
 
开发者ID:chr-krenn,项目名称:chr-krenn-fhj-ws2017-sd17-pse,代码行数:10,代码来源:UserDAOImpl.java

示例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;
}
 
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:16,代码来源:AttachmentService.java

示例15: initBundle

import org.hibernate.Hibernate; //导入方法依赖的package包/类
protected void initBundle(@Nullable LanguageBundle bundle)
{
	if( bundle != null )
	{
		Hibernate.initialize(bundle.getStrings());
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:8,代码来源:AbstractEntityServiceImpl.java


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