當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。