[Hibernate-JIRA] Created: (HSEARCH-992) DB matrix test org.hibernate.search.test.bridge.BridgeTest fails against Sybase
by Hardy Ferentschik (JIRA)
DB matrix test org.hibernate.search.test.bridge.BridgeTest fails against Sybase
-------------------------------------------------------------------------------
Key: HSEARCH-992
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-992
Project: Hibernate Search
Issue Type: Bug
Components: tests
Affects Versions: 4.0.0.CR2
Reporter: Hardy Ferentschik
Assignee: Hardy Ferentschik
Fix For: 4.0.0.Final
The exception is:
{noformat}
org.hibernate.exception.SQLGrammarException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=DBALLO02.CLOUD, DRIVER=4.11.77
at org.hibernate.exception.internal.SQLStateConverter.convert(SQLStateConverter.java:100)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129)
at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
{noformat}
Trying to look up the error code seems to indicate that there is an unsupported column type. Looking at the log I can see:
{noformat}
12:20:10,716 (main) ERROR SchemaExport:426 - HHH000389: Unsuccessful: create table Cloud (id integer generated by default as identity, calendarDay timestamp, calendarHour timestamp, calendarMillisecond timestamp, calendarMinute timestamp, calendarMonth timestamp, calendarSecond timestamp, calendarYear timestamp, char1 char(1), char2 char(1) not null, clazz varchar(255), customFieldBridge varchar(255), customStringBridge varchar(255), dateDay timestamp, dateHour timestamp, dateMillisecond timestamp, dateMinute timestamp, dateMonth timestamp, dateSecond timestamp, dateYear timestamp, double1 double, double2 double not null, float1 float, float2 float not null, integerv1 integer, integerv2 integer not null, long1 bigint, long2 bigint not null, myCalendar timestamp, myDate timestamp, storm smallint not null, string varchar(255), type integer, uri varchar(255) for bit data, url varchar(255), uuid char(255) for bit data, primary key (id))
12:20:10,717 (main) ERROR SchemaExport:427 - DB2 SQL Error: SQLCODE=-604, SQLSTATE=42611, SQLERRMC=char(255), DRIVER=4.11.77
{noformat}
It seems the problem is _uuid char(255)_ where _char_ is not a valid data type. _UUID_ does not have any specific mapping confirmation in the test class _Cload_. I cannot find a mapping in the _Dialect_ class either. Almost seems like a Hibernate Core issue.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-6873) java.util.Date is fetched as java.sql.Timestamp from database which causes custom equal() method to fail
by Martin Burger (JIRA)
java.util.Date is fetched as java.sql.Timestamp from database which causes custom equal() method to fail
--------------------------------------------------------------------------------------------------------
Key: HHH-6873
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6873
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.8
Reporter: Martin Burger
Attachments: SimpleState.java
I have class SimpleState (in my actual application, that state class is more complex) that represents a state. A state consists of an Integer value (SimpleState.state) and a java.util.Date instance (SimpleState.created); the latter tells when the state was created.
Unfortunately, after Hibernate has fetched a persistent instance of SimpleState from the database, SimpleState.created refers to an instance of java.sql.Timestamp instead of java.util.Date as expected. This causes SimpleState's equals() method to fail in the following situation:
1. Persist SimpleState state with Hibernate in session #1.
2. Fetch state as state* from db via session #2 (thus, new session which is different from session #1).
3. Check for equality by calling state.equals(state*).
I would expect that state.equals(state*) holds, but it does not (output as printed by SimpleState.equals()):
class java.util.Date != class java.sql.Timestamp
Fri Dec 02 11:11:43 CET 2011 != 2011-12-02 11:11:43.0
1322820703319 != 1322820703000
Some people recommend to use Joda Time or to use a custom type / converter as workaround. However, I would prefer to keep my model totally independent from any constrain that would be implied by some persistence framework. Otherwise, I would have to keep all possible persistence frameworks (and all their respective peculiarities) in mind whenever I would create a model.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-6844) One-To-One fails to delete both sides if constraint violation occurs
by Jana (JIRA)
One-To-One fails to delete both sides if constraint violation occurs
--------------------------------------------------------------------
Key: HHH-6844
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6844
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.8
Environment: Using hibernate version 3.6.8 on a mac OS 10.x.
Reporter: Jana
In this example there are two object: User and Credentials and they have a unidirectional one-to-one relationship. If User fails to persist due to a constraint violation on the emailAddress field, then the Credentials are saved but not removed when the exception is thrown. So now in the database there is no User object but there is a Credentials object. I have set the cascade type to ALL so my expectations would be if an error occurs during persisting the User that neither object remains in the database. As a workaround I go and check for orphans. I've tried a bi-directional one-to-one to see if that made any difference but it also failed to cleanup after the exception.
Below is the code. I left out the setters/getters to condense the code. I know the orphanRemoval=true is redundant since I have cascadeType=ALL but was trying different ways to force the orphan to be removed so left it there in this example.
To test:
public class Test {
public void testPersist() {
User user = new User();
Credentials credentials = new Credentials();
credentials.setUsername("username");
credentials.setPassword("password");
user.setCredentials(credentials);
user.setEmailAddress("myemail(a)wherever.com");
user.persist(); // this will persist as expected.
User user2 = new User();
Credentials credentials2 = new Credentials();
credentials2.setUsername("username2");
credentials2.setPassword("password");
user2.setCredentials(credentials2);
user2.setEmailAddress("myemail(a)wherever.com"); // same email address so will cause a constraint violation
user2.persist(); // this will throw a constraint violation. User2 won't be persisted but credentials will leaving an orphan
}
}
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private Long id;
@NotNull
@Column(unique = true)
@Size(min = 1)
private String emailAddress;
@OneToOne(targetEntity=Credentials.class, cascade=CascadeType.ALL, fetch=FetchType.LAZY, orphanRemoval=true)
private Credentials credentials;
}
public class Credentials {
@NotNull
@Column(unique = true)
@Size(min = 1, max=255)
private String username;
@NotNull
@Size(min = 1, max=255)
private String password;
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-5409) bag and idbag should implement equals() and hashCode() the same way as other collections
by Dmitry Katsubo (JIRA)
bag and idbag should implement equals() and hashCode() the same way as other collections
----------------------------------------------------------------------------------------
Key: HHH-5409
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5409
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Reporter: Dmitry Katsubo
bags/idbags behave in inconsistent way in comparison to set/list/map in respect to {{equals()}} and {{hashCode()}}.
In {{[PersistentBag.java|http://fisheye.jboss.org/browse/Hibernate/core/trunk/core/src/main/java/org/hibernate/collection/PersistentBag.java?r=HEAD#l510]}} {{equals()}} and {{hashCode()}} methods are commented and in {{[PersistentIdentifierBag.java|http://fisheye.jboss.org/browse/Hibernate/core/trunk/core/src/main/java/org/hibernate/collection/PersistentIdentifierBag.java?r=HEAD]}} not present.
{{[PersistentMap.java|http://fisheye.jboss.org/browse/Hibernate/core/trunk/core/src/main/java/org/hibernate/collection/PersistentMap.java?r=HEAD#l449]}}, {{[PersistentSet.java|http://fisheye.jboss.org/browse/Hibernate/core/trunk/core/src/main/java/org/hibernate/collection/PersistentSet.java?r=HEAD#l428]}}, {{[PersistentList.java|http://fisheye.jboss.org/browse/Hibernate/core/trunk/core/src/main/java/org/hibernate/collection/PersistentList.java?r=HEAD#l484]}} however implement {{equals()}} and {{hashCode()}} methods correctly.
The intention of this is clear: to avoid loading of the lazy collection on simple {{equals()}} call.
* I think that it is a task for the end application to handle lazy collections as it is aware about this situation.
* If there is a strong demand of not loading collections on {{equals()}} call for some applications, I suggest to make this behaviour configurable via additional attribute in XML mapping for all collections.
* The behaviour should be documented as suggested in HHH-1642. I personally spend hours debugging before I understood why lists behave differently from bags.
Probably relative issues:
* HHH-3771 ({{equals()}} for lazy loaded objects)
* HHH-1642 ({{equals()}} for {{[AbstractPersistentCollection.SetProxy|http://fisheye.jboss.org/browse/Hibernate/core/trunk/core/src/main/java/org/hibernate/collection/AbstractPersistentCollection.java?r=HEAD#l636]}})
--
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, 5 months
[Hibernate-JIRA] Created: (HSEARCH-996) Upgrade to Hibernate Core 4.0.0.CR7
by Hardy Ferentschik (JIRA)
Upgrade to Hibernate Core 4.0.0.CR7
-----------------------------------
Key: HSEARCH-996
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-996
Project: Hibernate Search
Issue Type: Task
Components: engine
Affects Versions: 4.0.0.CR2
Reporter: Hardy Ferentschik
Assignee: Hardy Ferentschik
Fix For: 4.0.0.Final
Needs some code changes
{noformat}
ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project hibernate-search-orm: Compilation failure: Compilation failure:
[ERROR] /Users/hardy/work/hibernate/git/search/hibernate-search-orm/src/main/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java:[227,61] cannot find symbol
[ERROR] symbol : method getEntity()
[ERROR] location: class org.hibernate.PessimisticLockException
[ERROR] /Users/hardy/work/hibernate/git/search/hibernate-search-orm/src/main/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java:[230,65] cannot find symbol
[ERROR] symbol : method getEntity()
[ERROR] location: class org.hibernate.PessimisticLockException
[ERROR] -> [Help 1]
{noformat}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months
[Hibernate-JIRA] Created: (HSEARCH-997) Add short numeric bridge
by Mathieu Lachance (JIRA)
Add short numeric bridge
------------------------
Key: HSEARCH-997
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-997
Project: Hibernate Search
Issue Type: Improvement
Components: analyzer
Affects Versions: 4.0.0.Beta2
Reporter: Mathieu Lachance
when indexing a collection of short value using the @IndexedEmbedded + @NumericField + @Field annotation combinaison, it will return the expected NumericIterableBridge.
though when indexing a short value using the @NumericField + @Field annotation combinaison no bridge is associated with.
here's my understanding of the issue :
when guessing type in org.hibernate.search.bridge.impl.BridgeFactory::guessNumericFieldBridge, it will return null, and then throw an throw new SearchException( "Unable to guess FieldBridge for " + member.getName() ); since there's no ShortNumericBridge type exists.
i guess the correct implementation of the non-existing ShortNumericBridge would be :
public class ShortNumericFieldBridge extends NumericFieldBridge {
public Object get(String name, Document document) {
return Short.valueOf(document.getFieldable(name).stringValue());
}
}
then add we would need to do is add the new implementation into the static numericField map.
seem a nice addition to me, or is there something i missed somewhere ?
thanks
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months