[Hibernate-JIRA] Created: (HSEARCH-367) Support only one kind of Similarity per index
by Sanne Grinovero (JIRA)
Support only one kind of Similarity per index
---------------------------------------------
Key: HSEARCH-367
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-367
Project: Hibernate Search
Issue Type: Bug
Reporter: Sanne Grinovero
Fix For: 3.2.0
pasted from the developer's list:
Each time a new Document is added to the index,
the similarity relevant to that entity is looked up from the
pertaining documentBuilder
and set to the indexwriter:
AddWorkDelegate:
Similarity similarity = documentBuilder.getSimilarity();
writer.setSimilarity( similarity );
writer.addDocument( work.getDocument(), analyzer );
So the analyzer is scoped per document, the similarity is globally set
on the indexwriter.
Does this make sense to update the similarity for each add operation type?
This is a problem as I can't use two (more) threads to add documents to
the same index.
Is there a good use case for which someone might need a different
Similarity implementation
for different entities contained in the same index?
I'd like to change that to an "illegal configuration".
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (HV-257) ReflectionHelper.getValue fails to retrieve values from methods defined on a parent interface
by Amir Kibbar (JIRA)
ReflectionHelper.getValue fails to retrieve values from methods defined on a parent interface
---------------------------------------------------------------------------------------------
Key: HV-257
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-257
Project: Hibernate Validator
Issue Type: Bug
Components: validators
Affects Versions: 4.0.0.GA, 4.0.0.CR1, 4.0.0.Beta3, 4.0.0.Beta2, 4.0.0.Beta1, 4.0.0.Alpha3, 4.0.0.Alpha2, 4.0.0.Alpha1, 3.1.0.GA, 3.1.0.CR2, 3.1.0.CR1, 3.0.0.ga, Bundle 3.2.1
Environment: hibernate-validator 4.0.0.CR1
Reporter: Amir Kibbar
I've defined an interface A with method foo with a constraint annotation on it.
I've then defined an interface B that extends interface A.
I've created a proxy (invocation handler) that implements interface B at runtime.
When I try to validate the proxy object I get an IllegalAccessException because the modifier on the method the ReflectionHelper.getValue() is trying to invoke has the "public abstract" modifiers.
This can easily be solved if the getValue() will set method.setAccesible(true) before attempting to invoke it (and then reset it to the previous value obviously).
thanks,
Amir
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (HHH-4518) Undeterministic behavior on Session.close without commit or rollback
by Vladimir Nicolici (JIRA)
Undeterministic behavior on Session.close without commit or rollback
--------------------------------------------------------------------
Key: HHH-4518
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4518
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.0.SP1
Environment: Hibernate 3.3.0.SP1, Oracle 10.2.0.1.0, c3p0 pool
Reporter: Vladimir Nicolici
Attachments: Test.java
Closing a session without rollback or commit may cause the uncommitted changes to be committed.
First scenario:
Step 1. Obtain a session using SessionFactory.openSession, begin a transaction, makes some changes, don't commit, don't rollback, close the session.
Step 2. Obtain a new session, begin a transaction, do some unrelated changes, commit the transaction, close the session.
Result: the uncommitted changes performed in the first transaction are committed when the second transaction is committed.
This shouldn't happen, what happens with the second session should not affect the changes performed with the first session.
However, if instead of committing, you rollback the transaction from step 2, it also rollbacks the changes from step 1.
Even worse, the second session has access to the uncommitted data generated by the first transaction, violating transaction isolation.
Second scenario:
0. Configure a SessionFactory for an Oracle Database, with the c3p0 pool.
1. Obtain a session using SessionFactory.openSession, begin a transaction, makes some changes, don't commit, don't rollback, close the session.
2. Close the SessionFactory.
Result: the uncommitted changes performed in the first transaction are committed when the SessionFactory is closed, because all the connections in the pool are closed, and oracle connections perform an implicit commit on close.
If you use a different database, the changes will be rolled back.
To conclude the behavior when a session doesn't commit or rollback depends on:
- what the next Session does with the Connection;
- what database you are using.
What makes it worse is that the idiom recommended in the documentation for a non-managed environments (http://docs.jboss.org/hibernate/stable/core/reference/en/html/transaction...) is not safe:
// Non-managed environment idiom
Session sess = factory.openSession();
Transaction tx = null;
try {
tx = sess.beginTransaction();
// do some work
...
tx.commit();
}
catch (RuntimeException e) {
if (tx != null) tx.rollback();
throw e; // or display error message
}
finally {
sess.close();
}
If "do some work" will throw java.lang.Error, it will not be caught by the catch clause for RuntimeException, the compiler will not complain that the Error is not caught, because a java.lang.Error behaves the same as RuntimeException, not requiring the programmer to catch it.
This way, both the commit and the rollback code will not be executed, which may cause the first or second scenario to occur.
What developers using hibernate may do until the issue is fixed:
- replace "catch (RuntimeException e)" with "catch (Throwable t)" this will catch both java.lang.RuntimeException and java.lang.Error
This may not be a good idea though, because according to the java.lang.Error JavaDoc (http://java.sun.com/javase/6/docs/api/java/lang/Error.html): "a reasonable application should not try to catch" it.
- a better solution might be to move the rollback code to the "finally" block, like this:
// Non-managed environment idiom
Session sess = factory.openSession();
Transaction tx = null;
try {
tx = sess.beginTransaction();
// do some work
...
tx.commit();
}
finally {
if (tx != null && !tx.wasCommitted()) tx.rollback();
sess.close();
}
What I feel the developers of Hibernate should do:
- update the documentation to document the issue
- modify Session.close to perform rollback if the transaction has not been explicitly committed or rollback. If for some reason this can't be the default behavior, at least provide a configuration parameter to activate such behavior. This will result in much simpler and safer code, that will look like this:
// Non-managed environment idiom
Session sess = factory.openSession();
try {
sess.beginTransaction();
// do some work
...
sess.getTransaction().commit();
}
finally {
sess.close();
}
Which reminds me that it would be also be nice if Session would have a commitTransaction method...
I attached example code that reproduces the problem.
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (HHH-2412) Hibernate 3 cannot be compiled under JDK 6
by Ahmet A. Akin (JIRA)
Hibernate 3 cannot be compiled under JDK 6
------------------------------------------
Key: HHH-2412
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2412
Project: Hibernate3
Type: Task
Components: core
Versions: 3.2.1, 3.2.2
Environment: windows xp, JDK 6
Reporter: Ahmet A. Akin
Hibernate code cannot be compiled under JDK 6. Problems and possible solutions:
1- org.hibernate.jdbc.ResultSetWrapper implements ResultSet. But in Java 6, there are big changes in Resultset interface, and maybe 20+ more methods needs to be implemented in the ResultSetWrapper class. i would suggest eliminating this wrapper class once and for all, because it is only used in one method (in ColumnNameCache, getIndexForColumnName method) and i dont think there is a justification for using that wrapper class.
2- org.hibernate.lob.SerializableBlob needs to implement new Blob interface methods:
public void free() throws SQLException;
public InputStream getBinaryStream(long pos, long length) throws SQLException
But, if this class is publicly accesible or used by API's back compatibility issues needs to be checked.
3- Same as number 2, org.hibernate.lob.BlobImpl class needs to implement new Blob methods.
4- org.hibernate.lob.SerializableClob class needs to implent new Clob methods.
5- org.hibernate.lob.ClobImpl , same as 4.
In fact, Java 6 has a lot of JDBC improvements, maybe a java6 special extra package can be created., but that is a whole different issue.
--
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
15 years, 2 months