We moved to Zulip - go to https://hibernate.zulipchat.com/#narrow/stream/132096-hibernate-user instead.
This my snippet .I am calling this from spring controller
@Transactional
public boolean createIndex() {
Session session = sessionFactory.openSession();
boolean flag=false;
FullTextSession fullTextSession = Search.getFullTextSession(session);
try {
MassIndexer createIndexer = fullTextSession.createIndexer();
createIndexer.startAndWait();
flag=true;
} catch (InterruptedException e) {
e.printStackTrace();
}
return flag;
}
Hi I would like to know if when using JPQL it is possible to filter child collections of a parent (one to many) returned from a query ? By default only the parent objects can be filtered but the child collections are unfiltered.
In particular I would like to filter the elements in child collections two levels deep. A has collection of B. B has collection of C.
The query should return all A, B and C which meet the query and the collection of B's in A and C's in B should also only contain elements meeting the query.
So far I have been able to filter the B's in the child collection of A using join fetch. But was unable to filter the C's using join fetch.
Any ideas if this is possible ? Or do you have a suggestion how to solve this requirement.
Thanks!
I have two tables
Employee Table
Address Table
Employee Table hbm definition will have the following
<id name="empGkey" column="primarykey" type="java.lang.Long" unsaved-value="null">
<generator class="native"/>
</id>
<many-to-one name="empAddress" column="address" class="com.region.Address"
cascade="all" unique="false"> </many-to-one>
Address Table hbm definition will have the following
<id name="addressGkey" column="primarykey" type="java.lang.Long" unsaved-value="null">
<generator class="native"/>
</id>
<one-to-one name="addressEmp" class="com.region.Employee" property-ref="empAddress">
</one-to-one>
Currently the application throws the following exception when execute the following HQL query
from Address where primarykey = '1232';
More than one row with the given identifier was found: 1232, for class:
com.region.Employee (compact stack trace follows)
org.hibernate.loader.entity.AbstractEntityLoader.load
(AbstractEntityLoader.java:92)
Clarification
FullTextSession fullTextSession = Search.getFullTextSession(getSession());
SearchFactory searchFactory = fullTextSession.getSearchFactory();
QueryParser parser = new MultiFieldQueryParser(new String[] { "searchTermFieldName" },
searchFactory.getAnalyzer(ModelClassName.class));
org.apache.lucene.search.Query luceneQuery;
try {
luceneQuery = parser.parse(query);
org.hibernate.Query fullTextQuery = fullTextSession.createFullTextQuery(luceneQuery,
ModelClassName.class);
list = fullTextQuery.list();
} catch (ParseException e) {
LOG.info("Exception in lucene parsing" + e);
}
this is my code snippet
Hi,
I have huge text files - raw text. I want to convert them to a different language. Google/Microsoft/Yandex is best for online conversions. However we need to copy and paste and moreover it has size limitation as well.
Is there is any tool which i can use for bulk conversion at one shot which can give the output in multiple files.
Thanks in advance.