Here are the examples of the java api org.hibernate.Hibernate.initialize() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
76 Examples
19
Source : SimpleHibernateDao.java
with GNU Affero General Public License v3.0
from wkeyuan
with GNU Affero General Public License v3.0
from wkeyuan
/* (non-Javadoc)
* @see com.key.common.orm.hibernate.ISimpleHibernateDao#initProxyObject(java.lang.Object)
*/
@Override
public void initProxyObject(Object proxy) {
Hibernate.initialize(proxy);
}
19
Source : HibernateTemplate.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Override
public void initialize(Object proxy) throws DataAccessException {
try {
Hibernate.initialize(proxy);
} catch (HibernateException ex) {
throw SessionFactoryUtils.convertHibernateAccessException(ex);
}
}
19
Source : GitFilter.java
with MIT License
from theonedev
with MIT License
from theonedev
private Project getProject(HttpServletRequest request, HttpServletResponse response, String projectInfo) throws IOException {
String projectName = StringUtils.strip(projectInfo, "/");
if (projectName.contains("/"))
projectName = StringUtils.substringAfterLast(projectName, "/");
Project project = projectManager.find(projectName);
if (project == null)
throw new GitException(String.format("Unable to find project %s", projectName));
else
Hibernate.initialize(project);
return project;
}
19
Source : Item.java
with Apache License 2.0
from spot-next
with Apache License 2.0
from spot-next
/**
* Returns all fields annotated with the {@link Property} annotation.
*
* @param filter can be null or a predicate that further filters the returned item properties.
* @return all filtered item properties
*/
@JsonIgnore
public Map<String, Object> getProperties(BiPredicate<Field, Object> filter) {
// TODO is this really necessary?
if (this instanceof HibernateProxy) {
if (!Hibernate.isInitialized(this)) {
Hibernate.initialize(this);
}
}
return IndirectPropertyAccess.super.getProperties(filter);
}
19
Source : EJBTestBase.java
with Apache License 2.0
from servicecatalog
with Apache License 2.0
from servicecatalog
protected <T> T unproxyEnreplacedy(T template) {
if (template instanceof HibernateProxy) {
Hibernate.initialize(template);
template = (T) ((HibernateProxy) template).getHibernateLazyInitializer().getImplementation();
}
return template;
}
19
Source : AlertPlaylistModificationInterceptor.java
with Apache License 2.0
from robinfriedli
with Apache License 2.0
from robinfriedli
@Override
public void onDeleteChained(Object enreplacedy, Serializable id, Object[] state, String[] propertyNames, Type[] types) {
super.onDeleteChained(enreplacedy, id, state, propertyNames, types);
if (isFirsreplacedemRemoval && enreplacedy instanceof Song) {
// make sure artist collection is initialised before deletion since it might be required to display the removed
// song at which point the collection can not be initialised anymore, this is only required if only one item
// is removed, else the number of removed items is shown
Hibernate.initialize(((Song) enreplacedy).getArtists());
}
if (enreplacedy instanceof Playlisreplacedem) {
isFirsreplacedemRemoval = false;
}
}
19
Source : BibliographicRecordService.java
with GNU Affero General Public License v3.0
from progilone
with GNU Affero General Public License v3.0
from progilone
private void setDefaultValues(final BibliographicRecord record) {
if (StringUtils.isEmpty(record.getreplacedle()) && record.getDocUnit() != null) {
if (Hibernate.isInitialized(record.getDocUnit())) {
record.setreplacedle(record.getDocUnit().getLabel());
} else {
Hibernate.initialize(record.getDocUnit());
record.setreplacedle(record.getDocUnit().getLabel());
}
}
}
19
Source : Lot.java
with GNU Affero General Public License v3.0
from progilone
with GNU Affero General Public License v3.0
from progilone
public InternetArchiveCollection getCollectionIA() {
if (collectionIA != null) {
return collectionIA;
}
// TODO: gérer l'initialisation au niveau du service, ou au moins pas dans le getter
try {
if (!Hibernate.isInitialized(project)) {
Hibernate.initialize(project);
}
return project != null ? project.getCollectionIA() : null;
} catch (final LazyInitializationException e) {
LOG.warn("Problème d'initialisation (IA): {}", e.getMessage());
return null;
}
}
19
Source : Lot.java
with GNU Affero General Public License v3.0
from progilone
with GNU Affero General Public License v3.0
from progilone
public CinesPAC getPlanClreplacedementPAC() {
if (planClreplacedementPAC != null) {
return planClreplacedementPAC;
}
// TODO: gérer l'initialisation au niveau du service, ou au moins pas dans le getter
try {
if (!Hibernate.isInitialized(project)) {
Hibernate.initialize(project);
}
return project != null ? project.getPlanClreplacedementPAC() : null;
} catch (final LazyInitializationException e) {
LOG.warn("Problème d'initialisation (PAC): {}", e.getMessage());
return null;
}
}
19
Source : Lot.java
with GNU Affero General Public License v3.0
from progilone
with GNU Affero General Public License v3.0
from progilone
public User getProvider() {
if (provider != null) {
return provider;
}
// TODO: gérer l'initialisation au niveau du service, ou au moins pas dans le getter
try {
if (!Hibernate.isInitialized(project)) {
Hibernate.initialize(project);
}
return project != null ? project.getProvider() : null;
} catch (final LazyInitializationException e) {
LOG.warn("Problème d'initialisation (Provider): {}", e.getMessage());
return null;
}
}
19
Source : DocUnit.java
with GNU Affero General Public License v3.0
from progilone
with GNU Affero General Public License v3.0
from progilone
public CinesPAC getPlanClreplacedementPAC() {
if (planClreplacedementPAC != null) {
return planClreplacedementPAC;
}
// TODO: gérer l'initialisation au niveau du service, ou au moins pas dans le getter
try {
if (!Hibernate.isInitialized(lot)) {
Hibernate.initialize(lot);
}
if (getLot() == null) {
return null;
}
return getLot().getPlanClreplacedementPAC();
} catch (final LazyInitializationException e) {
// NOSONAR pour pas pourrir les logs car c'est qd mm souvent que ....
LOG.warn("Problème d'initialisation: {}", e.getMessage());
return null;
}
}
19
Source : DocUnit.java
with GNU Affero General Public License v3.0
from progilone
with GNU Affero General Public License v3.0
from progilone
public InternetArchiveCollection getCollectionIA() {
if (collectionIA != null) {
return collectionIA;
}
// TODO: gérer l'initialisation au niveau du service, ou au moins pas dans le getter
try {
if (!Hibernate.isInitialized(lot)) {
Hibernate.initialize(lot);
}
if (getLot() == null) {
return null;
}
return getLot().getCollectionIA();
} catch (final LazyInitializationException e) {
LOG.warn("Problème d'initialisation: {}", e.getMessage());
return null;
}
}
19
Source : WorkflowUtils.java
with GNU General Public License v2.0
from openkm
with GNU General Public License v2.0
from openkm
/**
* Copy process instance
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static ProcessInstance copy(org.jbpm.graph.exe.ProcessInstance pi) {
ProcessInstance vo = new ProcessInstance();
if (pi.getStart() != null) {
Calendar start = Calendar.getInstance();
start.setTime(pi.getStart());
vo.setStart(start);
}
if (pi.getEnd() != null) {
Calendar end = Calendar.getInstance();
end.setTime(pi.getEnd());
vo.setEnd(end);
}
vo.setId(pi.getId());
vo.setVersion(pi.getVersion());
vo.setKey(pi.getKey());
vo.setEnded(pi.hasEnded());
vo.setSuspended(pi.isSuspended());
// TODO https://jira.jboss.org/jira/browse/JBPM-1778
if (pi.getContextInstance().getVariables() != null) {
vo.setVariables(pi.getContextInstance().getVariables());
// Workaround for LazyInitializationException
for (String key : vo.getVariables().keySet()) {
Hibernate.initialize(vo.getVariables().get(key));
}
} else {
vo.setVariables(new HashMap<String, Object>());
}
ArrayList<Token> al = new ArrayList<Token>();
for (Iterator it = pi.findAllTokens().iterator(); it.hasNext(); ) {
org.jbpm.graph.exe.Token tk = (org.jbpm.graph.exe.Token) it.next();
al.add(copy(tk));
}
vo.setAllTokens(al);
vo.setRootToken(copy(pi.getRootToken()));
vo.setProcessDefinition(copy(pi.getProcessDefinition()));
return vo;
}
19
Source : OmrDAO.java
with GNU General Public License v2.0
from openkm
with GNU General Public License v2.0
from openkm
/**
* Force initialization of a proxy
*/
private void initializeOMR(Omr omr) {
if (omr != null) {
Hibernate.initialize(omr);
Hibernate.initialize(omr.getProperties());
}
}
19
Source : AutomationDAO.java
with GNU General Public License v2.0
from openkm
with GNU General Public License v2.0
from openkm
/**
* Force initialization of a proxy
*/
private void initialize(AutomationValidation aValidation) {
if (aValidation != null) {
Hibernate.initialize(aValidation);
Hibernate.initialize(aValidation.getParams());
}
}
19
Source : AutomationDAO.java
with GNU General Public License v2.0
from openkm
with GNU General Public License v2.0
from openkm
/**
* Force initialization of a proxy
*/
private void initialize(AutomationRule aRule) {
if (aRule != null) {
Hibernate.initialize(aRule);
initializeActions(aRule.getActions());
initializeValidations(aRule.getValidations());
}
}
19
Source : PowerSearchServiceImpl.java
with Apache License 2.0
from openequella
with Apache License 2.0
from openequella
@Override
protected void preUnlinkForClone(PowerSearch powerSearch) {
Hibernate.initialize(powerSearch.gereplacedemdefs());
}
19
Source : MimeTypeServiceImpl.java
with Apache License 2.0
from openequella
with Apache License 2.0
from openequella
private EntryCache createMappings(List<MimeEntry> entries) {
Map<String, MimeEntry> mappedEntries = new HashMap<String, MimeEntry>();
Map<String, MimeEntry> mimeEntries = new HashMap<String, MimeEntry>();
for (MimeEntry mimeEntry : entries) {
Collection<String> extensions = mimeEntry.getExtensions();
// Load it all up
Hibernate.initialize(mimeEntry.getAttributes());
for (String ext : extensions) {
mappedEntries.put(ext, mimeEntry);
}
mimeEntries.put(mimeEntry.getType(), mimeEntry);
}
return new EntryCache(mappedEntries, mimeEntries);
}
19
Source : ItemServiceImpl.java
with Apache License 2.0
from openequella
with Apache License 2.0
from openequella
@Transactional
protected Item reloadItem(ItemKey id) {
Item item = dao.get(id);
if (item != null) {
Hibernate.initialize(item);
initBundle(item.getName());
}
return item;
}
19
Source : DynaCollectionServiceImpl.java
with Apache License 2.0
from openequella
with Apache License 2.0
from openequella
@Override
protected void preUnlinkForClone(DynaCollection dc) {
Hibernate.initialize(dc.getUsageIds());
Hibernate.initialize(dc.getSchemas());
Hibernate.initialize(dc.gereplacedemDefs());
}
19
Source : LanguageBundle.java
with Apache License 2.0
from openequella
with Apache License 2.0
from openequella
public static void initBundle(LanguageBundle bundle) {
if (bundle != null) {
Hibernate.initialize(bundle.getStrings());
}
}
19
Source : SbiDataSetDAOImpl.java
with GNU Affero General Public License v3.0
from KnowageLabs
with GNU Affero General Public License v3.0
from KnowageLabs
private static void initialize(SbiDataSet dataset) {
Hibernate.initialize(dataset.getId());
Hibernate.initialize(dataset.getCategory());
Hibernate.initialize(dataset.getTransformer());
Hibernate.initialize(dataset.getScope());
Hibernate.initialize(dataset.getFederation());
}
19
Source : UserService.java
with Apache License 2.0
from jhipster
with Apache License 2.0
from jhipster
@Transactional(readOnly = true)
public List<String> getProjects(String organizationName, GitProvider gitProvider) {
Collection<GitCompany> organizations = this.getOrganizations(gitProvider);
if (organizations.isEmpty()) {
return Collections.emptyList();
}
Optional<GitCompany> organization = organizations.stream().filter(test -> test.getName().equals(organizationName)).findFirst();
if (organization.isEmpty()) {
return Collections.emptyList();
} else {
List<String> projects = organization.get().getGitProjects();
Hibernate.initialize(projects);
return projects;
}
}
19
Source : UserService.java
with Apache License 2.0
from jhipster
with Apache License 2.0
from jhipster
@Transactional(readOnly = true)
public Collection<GitCompany> getGroups() throws Exception {
Collection<GitCompany> groups = userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin().orElse(null)).orElseThrow(() -> new Exception("No authenticated user can be found.")).getGitCompanies();
Hibernate.initialize(groups);
return groups;
}
19
Source : UserService.java
with Apache License 2.0
from jhipster
with Apache License 2.0
from jhipster
@Transactional(readOnly = true)
public Collection<GitCompany> getOrganizations(GitProvider gitProvider) {
User user = userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin().orElse(null)).orElse(null);
Set<GitCompany> gitCompanies = gitCompanyRepository.findAllByUserAndGitProvider(user, gitProvider.getValue());
Hibernate.initialize(gitCompanies);
return gitCompanies;
}
19
Source : HibernateUtil.java
with Apache License 2.0
from isstac
with Apache License 2.0
from isstac
/**
* Gets an object as an instance of its persistent type if it is a hibernate proxy otherwise
* returns the same preplaceded in object
*
* @param persistentObject the object to unproxy
* @return the unproxied object
* @since 1.10
*/
public static <T> T getRealObjectFromProxy(T persistentObject) {
if (persistentObject == null) {
return null;
}
if (persistentObject instanceof HibernateProxy) {
Hibernate.initialize(persistentObject);
persistentObject = (T) ((HibernateProxy) persistentObject).getHibernateLazyInitializer().getImplementation();
}
return persistentObject;
}
19
Source : HibernateUtils.java
with Apache License 2.0
from igloo-project
with Apache License 2.0
from igloo-project
public static void initialize(Object potentiallyProxyfiedObject) {
Hibernate.initialize(potentiallyProxyfiedObject);
// Initialize wrapped collections (Collections.unmodifiableCollection, for instance)
if (potentiallyProxyfiedObject instanceof Collection) {
((Collection<?>) potentiallyProxyfiedObject).iterator();
}
// Initialize wrapped maps
if (potentiallyProxyfiedObject instanceof Map) {
((Map<?, ?>) potentiallyProxyfiedObject).entrySet().iterator();
}
}
19
Source : ExportService.java
with European Union Public License 1.1
from EUSurvey
with European Union Public License 1.1
from EUSurvey
@SuppressWarnings("unchecked")
@Transactional(readOnly = true)
public List<Export> getExports(int userId, String sortKey, boolean ascending, int page, int rowsPerPage, boolean eagerloading, boolean determinestate, boolean onlynotnotified) {
Session session = sessionFactory.getCurrentSession();
// I do this for security reasons as we will use string concatenation below (bad practice but hibernate does not allow to use parameters for ordering)
if (!(sortKey.equals("form") || sortKey.equals("date"))) {
sortKey = "name";
}
if (sortKey.equals("form")) {
sortKey = "survey.replacedleSort";
}
Query query;
if (userId == -1) {
query = session.createQuery("SELECT e FROM Export e LEFT JOIN e.survey survey WHERE e.userId > 0 ORDER BY e." + sortKey + " " + (ascending ? "ASC" : "DESC"));
} else {
String sql = "SELECT e FROM Export e LEFT JOIN e.survey survey WHERE e.userId = :userId";
if (onlynotnotified) {
sql += " AND e.state = 2 AND e.notified = false";
}
query = session.createQuery(sql + " ORDER BY e." + sortKey + " " + (ascending ? "ASC" : "DESC"));
query.setInteger("userId", userId);
}
List<Export> exports = null;
if (page > -1) {
if (rowsPerPage < 0)
rowsPerPage = 0;
@SuppressWarnings("rawtypes")
List list = query.setFirstResult(page * rowsPerPage).setMaxResults(rowsPerPage).setReadOnly(true).list();
exports = list;
} else {
if (onlynotnotified) {
query.setMaxResults(1);
}
@SuppressWarnings("rawtypes")
List list = query.setReadOnly(true).list();
exports = list;
}
List<Export> result = new ArrayList<>();
for (Export export : exports) {
if (export.getSurvey() == null || !export.getSurvey().getArchived()) {
if (eagerloading) {
if (export.getResultFilter() != null) {
Hibernate.initialize(export.getResultFilter().getLanguages());
Hibernate.initialize(export.getResultFilter().getFilterValues());
Hibernate.initialize(export.getResultFilter().getVisibleQuestions());
Hibernate.initialize(export.getResultFilter().getExportedQuestions());
}
if (export.getActivityFilter() != null) {
Hibernate.initialize(export.getActivityFilter().getVisibleColumns());
Hibernate.initialize(export.getActivityFilter().getExportedColumns());
}
if (determinestate)
determineValidState(export, true);
} else {
if (determinestate)
determineValidState(export, false);
}
result.add(export);
}
}
return result;
}
19
Source : ExportService.java
with European Union Public License 1.1
from EUSurvey
with European Union Public License 1.1
from EUSurvey
@Transactional(readOnly = true)
public Export getExport(int exportId, boolean eagerloading) {
try {
Session session = sessionFactory.getCurrentSession();
Export export = (Export) session.get(Export.clreplaced, exportId);
determineValidState(export, false);
if (eagerloading) {
Hibernate.initialize(export.getActivityFilter());
Hibernate.initialize(export.getResultFilter());
if (export.getResultFilter() != null) {
Hibernate.initialize(export.getResultFilter().getLanguages());
Hibernate.initialize(export.getResultFilter().getExportedQuestions());
Hibernate.initialize(export.getResultFilter().getFilterValues());
Hibernate.initialize(export.getResultFilter().getVisibleQuestions());
}
}
return export;
} catch (Exception e) {
logger.error(e.getLocalizedMessage(), e);
return null;
}
}
19
Source : testHibernate.java
with MIT License
from anselleeyy
with MIT License
from anselleeyy
@Test
public void test5() {
List<Teacher> list = (List<Teacher>) teacherService.selectAllTeacher();
Hibernate.initialize(list.get(0).getDepartment());
System.out.println(list.get(0).getDepartment());
}
18
Source : IssueChoiceProvider.java
with MIT License
from theonedev
with MIT License
from theonedev
@Override
public Collection<Issue> toChoices(Collection<String> ids) {
List<Issue> issues = Lists.newArrayList();
IssueManager issueManager = OneDev.getInstance(IssueManager.clreplaced);
for (String id : ids) {
Issue issue = issueManager.load(Long.valueOf(id));
Hibernate.initialize(issue);
issues.add(issue);
}
return issues;
}
18
Source : AbstractGroupChoiceProvider.java
with MIT License
from theonedev
with MIT License
from theonedev
@Override
public Collection<Group> toChoices(Collection<String> ids) {
List<Group> groups = Lists.newArrayList();
GroupManager groupManager = OneDev.getInstance(GroupManager.clreplaced);
for (String each : ids) {
Group group = groupManager.load(Long.valueOf(each));
Hibernate.initialize(group);
groups.add(group);
}
return groups;
}
18
Source : EventBO.java
with GNU General Public License v3.0
from SoapboxRaceWorld
with GNU General Public License v3.0
from SoapboxRaceWorld
public EventSessionEnreplacedy findEventSessionById(Long id) {
EventSessionEnreplacedy eventSession = eventSessionDao.find(id);
Hibernate.initialize(eventSession.getEvent().getSingleplayerRewardConfig());
Hibernate.initialize(eventSession.getEvent().getMultiplayerRewardConfig());
Hibernate.initialize(eventSession.getEvent().getPrivateRewardConfig());
return eventSession;
}
18
Source : DocUnitService.java
with GNU Affero General Public License v3.0
from progilone
with GNU Affero General Public License v3.0
from progilone
@Transactional
public void delete(final String identifier, final boolean deleteImpDocUnits) {
final DocUnit docUnit = docUnitRepository.findOne(identifier);
// Suppression des références à l'unité doreplacedentaire dans les tables d'import
if (deleteImpDocUnits) {
importedDocUnitRepository.deleteByDocUnitIdentifier(identifier);
importedDocUnitRepository.deleteDuplicatedUnitsByDocUnitIdentifier(identifier);
// internet archive
internetArchiveReportRepository.deleteByDocUnitIdentifier(identifier);
} else // Sinon on creplacede juste le lien entre DocUnit et ImportedDocUnit, en conservant ce dernier
{
importedDocUnitRepository.setDocUnitNullByDocUnitIdIn(Collections.singletonList(identifier));
importedDocUnitRepository.deleteDuplicatedUnitsByDocUnitIdentifier(identifier);
// internet archive
internetArchiveReportRepository.deleteByDocUnitIdentifier(identifier);
}
// CinesReport
cinesReportRepository.deleteByDocUnitIdentifier(identifier);
// Constats d'état (db + elasticsearch)
conditionReportService.deleteByDocUnitIdentifier(identifier);
// Lien vers les UD filles
docUnitRepository.setParentNullByParentIdIn(Collections.singletonList(identifier));
final DocSibling sib = docSiblingRepository.findByDocUnitsIdentifier(identifier);
// Suppression UD
docUnitRepository.delete(identifier);
// Liens vers les UD soeurs
if (sib != null) {
Hibernate.initialize(sib.getDocUnits());
if (sib.getDocUnits().size() == 1) {
docSiblingRepository.delete(sib);
}
}
// Moteur de recherche
esDocUnitService.deleteAsync(docUnit);
}
18
Source : AuditDocUnitRepository.java
with GNU Affero General Public License v3.0
from progilone
with GNU Affero General Public License v3.0
from progilone
/**
* Recherche une révision précise d'une UD
*
* @param id
* @param rev
* @return
*/
public DocUnit getEnreplacedy(final String id, final Number rev) {
final AuditReader auditReader = AuditReaderFactory.get(em);
final DocUnit docUnit = auditReader.find(DocUnit.clreplaced, id, rev);
try {
Hibernate.initialize(docUnit.getLot());
} catch (final EnreplacedyNotFoundException e) {
LOG.warn(e.getMessage());
}
return docUnit;
}
18
Source : AutomationDAO.java
with GNU General Public License v2.0
from openkm
with GNU General Public License v2.0
from openkm
/**
* Force initialization of a proxy
*/
private void initialize(AutomationAction aAction) {
if (aAction != null) {
Hibernate.initialize(aAction);
Hibernate.initialize(aAction.getParams());
}
}
18
Source : SchemaServiceImpl.java
with Apache License 2.0
from openequella
with Apache License 2.0
from openequella
@Override
protected void preUnlinkForClone(Schema schema) {
Hibernate.initialize(schema.getExportTransforms());
Hibernate.initialize(schema.getImportTransforms());
Hibernate.initialize(schema.getCitations());
}
18
Source : ItemDefinitionServiceImpl.java
with Apache License 2.0
from openequella
with Apache License 2.0
from openequella
@Override
protected void preUnlinkForClone(ItemDefinition definition) {
Hibernate.initialize(definition.getSlow());
}
18
Source : AtheneService.java
with MIT License
from ls1intum
with MIT License
from ls1intum
/**
* Parse text blocks of type AtheneDTO.TextBlock to TextBlocks linked to their submission
*
* @param blocks The list of AtheneDTO-blocks to parse
* @param exerciseId The exerciseId of the exercise the blocks belong to
* @return list of TextBlocks
*/
public List<TextBlock> parseTextBlocks(List<AtheneDTO.TextBlockDTO> blocks, Long exerciseId) {
// Create submissionsMap for lookup
List<TextSubmission> submissions = textSubmissionService.getTextSubmissionsWithTextBlocksByExerciseId(exerciseId);
Map<Long, TextSubmission> submissionsMap = submissions.stream().collect(toMap(/* Key: */
Submission::getId, /* Value: */
submission -> submission));
// Map textBlocks to submissions
List<TextBlock> textBlocks = new LinkedList();
for (AtheneDTO.TextBlockDTO textBlockDTO : blocks) {
// Convert DTO-TextBlock (including the submissionId) to TextBlock Enreplacedy
TextBlock newBlock = new TextBlock();
newBlock.setId(textBlockDTO.getId());
newBlock.setText(textBlockDTO.getText());
newBlock.setStartIndex(textBlockDTO.getStartIndex());
newBlock.setEndIndex(textBlockDTO.getEndIndex());
newBlock.automatic();
// take the corresponding TextSubmission and add the text blocks.
// The addBlocks method also sets the submission in the textBlock
Hibernate.initialize(submissionsMap.get(textBlockDTO.getSubmissionId()).addBlock(newBlock));
submissionsMap.get(textBlockDTO.getSubmissionId()).addBlock(newBlock);
textBlocks.add(newBlock);
}
return textBlocks;
}
18
Source : AdmissionIoOperations.java
with GNU General Public License v3.0
from informatici
with GNU General Public License v3.0
from informatici
/**
* Load patient together with the profile photo, or <code>null</code> if there is no patient with the given id
*/
public AdmittedPatient loadAdmittedPatient(final Integer patientId) {
final Patient patient = patientRepository.findOne(patientId);
if (patient == null) {
return null;
}
Hibernate.initialize(patient.getPatientProfilePhoto());
final Admission admission = repository.findOneWherePatientIn(patientId);
return new AdmittedPatient(patient, admission);
}
18
Source : ApiService.java
with Apache License 2.0
from getheimdall
with Apache License 2.0
from getheimdall
/**
* Find plans from {@link Api} by its ID.
*
* @param id The ID of the {@link Api}
* @return List of the {@link Plan}
*/
@Transactional(readOnly = true)
public List<Plan> plansByApi(Long id) {
Api found = apiRepository.findOne(id);
HeimdallException.checkThrow(Objects.isNull(found), API_NOT_EXIST);
Hibernate.initialize(found.getPlans());
return found.getPlans();
}
18
Source : SessionService.java
with European Union Public License 1.1
from EUSurvey
with European Union Public License 1.1
from EUSurvey
public ResultFilter getResultFilter(int userid, int surveyid) {
Session session = sessionFactory.getCurrentSession();
Query query = session.createQuery("FROM ResultFilter r WHERE r.userId = :userid and r.surveyId = :surveyid ORDER BY r.id DESC").setInteger("userid", userid).setInteger("surveyid", surveyid);
@SuppressWarnings("unchecked")
List<ResultFilter> result = query.list();
if (!result.isEmpty()) {
Hibernate.initialize(result.get(0).getLanguages());
return result.get(0);
}
return null;
}
18
Source : ExportService.java
with European Union Public License 1.1
from EUSurvey
with European Union Public License 1.1
from EUSurvey
@Transactional(readOnly = false)
public void prepareExport(Form form, Export export) {
Session session = sessionFactory.getCurrentSession();
if (export.getResultFilter() != null) {
session.saveOrUpdate(export.getResultFilter());
Hibernate.initialize(export.getResultFilter().getExportedQuestions());
Hibernate.initialize(export.getResultFilter().getLanguages());
Hibernate.initialize(export.getResultFilter().getFilterValues());
Hibernate.initialize(export.getResultFilter().getVisibleQuestions());
}
session.saveOrUpdate(export);
session.flush();
if (form != null && form.getSurvey() != null) {
Hibernate.initialize(form.getSurvey().getElementsRecursive(true));
}
if (export.getActivityFilter() != null) {
Hibernate.initialize(export.getActivityFilter().getExportedColumns());
Hibernate.initialize(export.getActivityFilter().getVisibleColumns());
}
}
18
Source : BookstoreService.java
with Apache License 2.0
from AnghelLeonard
with Apache License 2.0
from AnghelLeonard
// second query/request
@Transactional(readOnly = true)
public List<Book> fetchBooksOfAuthorBad(Author a) {
Author author = fetchAuthor(a.getId());
List<Book> books = author.getBooks();
Hibernate.initialize(books);
// books.size();
return books;
}
17
Source : PipelineDAOImpl.java
with Apache License 2.0
from yahoo
with Apache License 2.0
from yahoo
/**
* Performs eager fetch.
*/
@Override
public Pipeline fetch(Session session, long id) {
Pipeline pipeline = super.fetch(session, id);
if (pipeline != null) {
Hibernate.initialize(pipeline.getProjections());
}
return pipeline;
}
17
Source : PipelineDAOImpl.java
with Apache License 2.0
from yahoo
with Apache License 2.0
from yahoo
/**
* Fetch all the pipelines.
* If fetch mode is eager, it will fetch the projections for each pipeline.
* If fetch mode is lazy, projections will not be fetched.
*/
@Override
public List<Pipeline> fetchAll(Session session, FetchMode mode) {
List<Pipeline> pipelines = super.fetchAll(session);
if (mode == FetchMode.EAGER) {
if (pipelines != null) {
for (Pipeline pipeline : pipelines) {
Hibernate.initialize(pipeline.getProjections());
}
}
return pipelines;
} else {
// default is LAZY
return Pipeline.simplifyPipelineList(pipelines);
}
}
17
Source : FunnelGroupDAOImpl.java
with Apache License 2.0
from yahoo
with Apache License 2.0
from yahoo
/**
* Performs eager fetch.
*/
@Override
public FunnelGroup fetch(Session session, long id) {
FunnelGroup funnelGroup = super.fetch(session, id);
if (funnelGroup != null) {
Hibernate.initialize(funnelGroup.getProjections());
Hibernate.initialize(funnelGroup.getPipelines());
}
return funnelGroup;
}
17
Source : AbstractUserChoiceProvider.java
with MIT License
from theonedev
with MIT License
from theonedev
@Override
public Collection<User> toChoices(Collection<String> ids) {
List<User> users = Lists.newArrayList();
UserManager userManager = OneDev.getInstance(UserManager.clreplaced);
for (String each : ids) {
User user = userManager.load(Long.valueOf(each));
Hibernate.initialize(user);
users.add(user);
}
return users;
}
17
Source : MilestoneChoiceProvider.java
with MIT License
from theonedev
with MIT License
from theonedev
@Override
public Collection<Milestone> toChoices(Collection<String> ids) {
List<Milestone> milestones = Lists.newArrayList();
MilestoneManager milestoneManager = OneDev.getInstance(MilestoneManager.clreplaced);
for (String each : ids) {
Milestone milestone = milestoneManager.load(Long.valueOf(each));
Hibernate.initialize(milestone);
milestones.add(milestone);
}
return milestones;
}
17
Source : BuildChoiceProvider.java
with MIT License
from theonedev
with MIT License
from theonedev
@Override
public Collection<Build> toChoices(Collection<String> ids) {
List<Build> builds = Lists.newArrayList();
BuildManager buildManager = OneDev.getInstance(BuildManager.clreplaced);
for (String id : ids) {
Build build = buildManager.load(Long.valueOf(id));
Hibernate.initialize(build);
builds.add(build);
}
return builds;
}
See More Examples