本文整理匯總了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());
}
}