[Hibernate-JIRA] Created: (HSEARCH-1093) Smarter dirty checking with @Transient fields
by Marc Schipperheyn (JIRA)
Smarter dirty checking with @Transient fields
---------------------------------------------
Key: HSEARCH-1093
URL: https://hibernate.onjira.com/browse/HSEARCH-1093
Project: Hibernate Search
Issue Type: Improvement
Affects Versions: 4.1.0.Final
Reporter: Marc Schipperheyn
I found that if you have a field that is @Transient and depends on a Hibernate managed field, this field is not updated when the underlying field changes.
{code}
@ManyToOne
@JoinColumn
@IndexedEmbedded
public Photo getPhoto() {
return photo;
}
@Transient
@Field
public String getMugshot(){
if(photo == null)
return null;
return getUserDirectory() + "/" + photo.getFilename();
}
{code}
This makes sense. However, it's not desirable. I would therefore want to propose an annotation that can add some magic to dirty checking and inform Hibernate Search that when @Field x gets dirty, the @Transient field should also be considered dirty
Something like
{code}
@ManyToOne
@JoinColumn
@IndexedEmbedded
public Photo getPhoto() {
return photo;
}
@Transient
@Field
@AssociateDirty(fields={"photo"})
public String getMugshot(){
if(photo == null)
return null;
return getUserDirectory() + "/" + photo.getFilename();
}
{code}
There are many names one might give to such an annotation. E.g. @YouDirtyMeDirty, but many somehow sound a little "dirty" :-)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years
[Hibernate-JIRA] Created: (HSEARCH-1087) Synchronization during JTA afterCompletion() incompatible with Hibernate-Core
by Eli Colner (JIRA)
Synchronization during JTA afterCompletion() incompatible with Hibernate-Core
-----------------------------------------------------------------------------
Key: HSEARCH-1087
URL: https://hibernate.onjira.com/browse/HSEARCH-1087
Project: Hibernate Search
Issue Type: Bug
Components: engine
Affects Versions: 4.0.0.Final
Reporter: Eli Colner
Priority: Critical
During synchronization Hibernate Core's SessionImpl.close() calls org.hibernate.engine.transaction.internal.TransactionCoordinator.close() which in-turns calls org.hibernate.engine.transaction.internal.TransactionCoordinator.reset(). During the reset the transactionCoordinator calls org.hibernate.engine.transaction.internal.SynchronizationRegistry.clearSynchronizations(). The synchronizations list is emptied and nulled. This removes the BeforeCommitSynchronizationDelegator instance that was registered from org.hibernate.search.backend.impl.EventSourceTransactionContext.registerSynchronization() during the JTA transaction. Clearing the synchronization list causes a ConcurrentModificationException to be thrown from org.hibernate.search.backend.impl.SynchronizationRegistryImpl.notifySynchronizationsAfterTransactionCompletion() because it is iterating the synchronization list and at the start it contains two Synchronization instances in this order (EntityManagerImpl.Synchronization, BeforeCommitSynchronizationDelegator). So, basically the first Synchronization is removing the second Synchronization while in a loop...
ARJUNA016029: SynchronizationImple.afterCompletion - failed for org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@192e31c with exception
java.util.ConcurrentModificationException
at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:373)
at java.util.LinkedHashMap$KeyIterator.next(LinkedHashMap.java:384)
at org.hibernate.engine.transaction.internal.SynchronizationRegistryImpl.notifySynchronizationsAfterTransactionCompletion(SynchronizationRegistryImpl.java:78)
at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.sendAfterTransactionCompletionNotifications(TransactionCoordinatorImpl.java:335)
at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.afterTransaction(TransactionCoordinatorImpl.java:147)
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.afterCompletion(SynchronizationCallbackCoordinatorImpl.java:126)
at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.afterCompletion(RegisteredSynchronization.java:61)
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.afterCompletion(SynchronizationImple.java:117)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.afterCompletion(TwoPhaseCoordinator.java:403)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:104)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:159)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1162)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:119)
at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1010)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years
[Hibernate-JIRA] Created: (HSEARCH-1095) Near Real Time + RAM seems to not work
by Emmanuel Bernard (JIRA)
Near Real Time + RAM seems to not work
--------------------------------------
Key: HSEARCH-1095
URL: https://hibernate.onjira.com/browse/HSEARCH-1095
Project: Hibernate Search
Issue Type: Bug
Components: engine
Reporter: Emmanuel Bernard
Assignee: Sanne Grinovero
{code}
13:34:02,078 ERROR [org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask] (Hibernate Search: Index updates queue processor for index org.jboss.as.quickstarts.kitchensink.model.Member-1) HSEARCH000073: Error in backend: java.lang.NullPointerException
at org.hibernate.search.backend.impl.lucene.NRTWorkspaceImpl.flush(NRTWorkspaceImpl.java:171) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final]
at org.hibernate.search.backend.impl.lucene.NRTWorkspaceImpl.afterTransactionApplied(NRTWorkspaceImpl.java:79) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final]
at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.applyUpdates(LuceneBackendQueueTask.java:138) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final]
at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.run(LuceneBackendQueueTask.java:67) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [classes.jar:1.6.0_31]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [classes.jar:1.6.0_31]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [classes.jar:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_31]
at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31]
13:34:02,099 ERROR [org.hibernate.search.exception.impl.LogErrorHandler] (Hibernate Search: Index updates queue processor for index org.jboss.as.quickstarts.kitchensink.model.Member-1) HSEARCH000058: Exception occurred java.lang.NullPointerException
Primary Failure:
Entity org.jboss.as.quickstarts.kitchensink.model.Member Id 1 Work Type org.hibernate.search.backend.AddLuceneWork
Subsequent failures:
Entity org.jboss.as.quickstarts.kitchensink.model.Member Id 2 Work Type org.hibernate.search.backend.AddLuceneWork
Entity org.jboss.as.quickstarts.kitchensink.model.Member Id 3 Work Type org.hibernate.search.backend.AddLuceneWork
Entity org.jboss.as.quickstarts.kitchensink.model.Member Id 4 Work Type org.hibernate.search.backend.AddLuceneWork
java.lang.NullPointerException
at org.hibernate.search.backend.impl.lucene.NRTWorkspaceImpl.flush(NRTWorkspaceImpl.java:171) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final]
at org.hibernate.search.backend.impl.lucene.NRTWorkspaceImpl.afterTransactionApplied(NRTWorkspaceImpl.java:79) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final]
at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.applyUpdates(LuceneBackendQueueTask.java:138) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final]
at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.run(LuceneBackendQueueTask.java:67) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [classes.jar:1.6.0_31]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [classes.jar:1.6.0_31]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [classes.jar:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_31]
at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31]
{code}
{code}@Entity
@XmlRootElement
@Table(uniqueConstraints = @UniqueConstraint(columnNames = "email"))
@Indexed
public class Member implements Serializable {
/** Default value included to remove warning. Remove or modify at will. **/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id;
@NotNull
@Size(min = 1, max = 25)
@Pattern(regexp = "[A-Za-z ]*", message = "must contain only letters and spaces")
@Field
private String name;
@NotNull
@NotEmpty
@Email
private String email;
@NotNull
@Size(min = 10, max = 12)
@Digits(fraction = 0, integer = 12)
@Column(name = "phone_number")
private String phoneNumber;
@NotEmpty
@Size(min = 2, max = 50)
@Field
private String location;
@NotEmpty
@Size(min = 2, max = 50)
@Field
private String job;
{code}
{code}<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="primary">
<!-- If you are running in a production environment, add a managed
data source, this example data source is just for development and testing! -->
<!-- The datasource is deployed as WEB-INF/kitchensink-quickstart-ds.xml, you
can find it in the source at src/main/webapp/WEB-INF/kitchensink-quickstart-ds.xml -->
<jta-data-source>java:jboss/datasources/KitchensinkQuickstartDS</jta-data-source>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.search.default.indexmanager" value="near-real-time"/>
<property name="hibernate.search.default.directory_provider" value="ram"/>
</properties>
</persistence-unit>
</persistence>
{code}
When I comment <property name="hibernate.search.default.indexmanager" value="near-real-time"/>, it works
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years