[Hibernate-JIRA] Created: (HHH-3724) Bug in determining the getter method for property
by Senthil (JIRA)
Bug in determining the getter method for property
--------------------------------------------------
Key: HHH-3724
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3724
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: hibernate-core-3.3.1.GA.jar, Oracle Express Edition 10g
Reporter: Senthil
Priority: Minor
I have an entity class with a property "String nextOnError" mapping to the database column "varchar nextOnError". I have a getter method "String getNextOnError()" defined in the class. But I also have another method "boolean isNextOnError()" for my other processing in the application. I was expecting hibernate would pick the getter method "String getNextOnError()" as the getter method but it is not. It is always picking the "boolean isNextOnError()" and resulting in "Class cast exception: java.lang.Boolean" during insertion. This is because, for each property, in the class "org.hibernate.property.BasicPropertyAccessor", the method "getterMethod(Class theClass, String propertyName)" is looping through all the getter methods with no arguments. The loop breaks when it finds any method starts with either "isNextOnError()" or "getNextOnError()". Unfortunately, in my case, it always ends up with "boolean isNextOnError()". I think the correct way is to check all the methods for starting with get... and if nothing is found, then start looking for method starting with 'is...' .
Thanks.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 6 months
[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, 6 months
[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, 6 months
[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, 6 months
[Hibernate-JIRA] Created: (HHH-4504) Query on polyphomic association
by Rafael Santini (JIRA)
Query on polyphomic association
-------------------------------
Key: HHH-4504
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4504
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.6
Environment: MySQL 5.0.51a-community-nt
Reporter: Rafael Santini
The following query on a polyphormic association does not works:
from Pessoa where nome = 'Rafael';
Error: Unknown column 'pessoa1_1_.nome' in 'where clause'
Mapping:
<class name="Pessoa" table="bs_com_pessoa">
<id name="id" type="java.lang.Long">
<generator class="native"/>
</id>
<joined-subclass name="PessoaFisica" table="bs_com_pessoa_fisica">
<key column="id_pessoa"/>
<property column="nome" name="nome" not-null="true"/>
</joined-subclass>
<joined-subclass name="PessoaJuridica" table="bs_com_pessoa_juridica">
<key column="id_pessoa"/>
<property name="razaoSocial" column="razao_social" not-null="true"/>
<property name="nomeFantasia" column="nome_fantasia" not-null="true"/>
</joined-subclass>
</class>
<class name="Cliente" table="bs_erp_cliente">
<id name="id" type="java.lang.Integer">
<generator class="native"/>
</id>
<many-to-one name="pessoa" class="Pessoa" column="id_pessoa" not-null="true" unique="true" cascade="all"/>
</class>
SQL generated by Hibernate:
select cliente0_.id as id18_, cliente0_.id_pessoa as id2_18_ from bs_erp_cliente cliente0_, bs_com_pessoa pessoa1_ where cliente0_.id_pessoa=pessoa1_.id and (pessoa1_1_.nome like ?) order by pessoa1_1_.nome
There is not pessoa1_1_ in the from clause.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 7 months