ArrayHelper cleanup
by Vlad Mihalcea
Hi,
When reviewing this PR (
https://github.com/hibernate/hibernate-orm/pull/1305/files), I noticed that
some methods can be simply replaced by java.util.Arrays (e.g. indexOf,
toStringArray),
while other methods are not used at all (e.g. reverse).
Since this is an internal helper utility, do we want to clean it by
removing the unused/commented/redundant methods, or shall we leave it as is?
Vlad
8 years, 9 months
Release bundle doesn't contain spatial lib
by Karel Maesen
Hi all,
A user recently asked where the hibernate-spatial jar could be found. The
Quickstart states that it should be in the /lib directory, but at least
recent bundles don't contain it (e.g. 5.1.0.Final).
How can this be fixed?
Regards,
Karel
8 years, 9 months
Editing the OGM quickstart on hibernate.org
by Sanne Grinovero
Hello team,
I've started making several improvements for the Hibernate OGM Quick
Start on the hibernate.org website;
I got side-tracked to test it all, but also the new version will
assume that we already released version 5.0.0.Final so I'll hold the
changes for until the release - or shortly before for review.
Just so you know to not change it too ;)
Sanne
8 years, 9 months
Tests fail on MySQL due to timestamp precision issues
by Vlad Mihalcea
Hi,
While running the test suite on MySQL, I noticed that some of those fail
because of DATETIME/TIMESTAMP precision.
Prior to MySQL 5.6.4, these types didn't have microsecond precision at all.
Using a newer MySQL version, these tests will work like on other DBs but it
will require changing the column definitions to DATETIME(6), TIMESTAMP(6).
To avoid breaking backward compatibility, what do you think of adding a new
Configuration Property: "hibernate.mysql.fractional.seconds" (or a
MySQLDialect method)
which gives the default fractional second precision used when creating
these column types.
This way we can have all these tests work with just a single Hibernate
configuration property.
Vlad
8 years, 9 months
Sharing association table for multiple associations between two entity types
by Gunnar Morling
Hi,
I've two entity types, "User" and "PhoneNumber",with two associations
between them: User#phoneNumbers() and User#alternativePhoneNumbers().
By default, only one mapping table is created for these two:
create table User_PhoneNumber (
Parent_id bigint not null,
phoneNumbers_id bigint not null,
alternativePhoneNumbers_id bigint not null
)
At runtime things will fail because of the NOT NULL constraints: Only
one of "phoneNumbers_id" and "alternativePhoneNumbers_id" will be set
for a given association row.
If I remove the constraints (e.g. pretending to work with a legacy
database), things seem to work: association rows are inserted into the
right columns and also are loaded correctly.
My question: Should such sharing of association tables be supported or
not? If yes, we'd have to adapt the generated DDL (making both columns
nullable, and optionally add a check constraint to make sure exactly
one is not null). For map associations, also a primary key is
generated for one of the two associations, so that'd have to be
adapted as well.
If that's not to be supported, can we fail early on, demanding the
user to specify distinct join tables?
I had filed https://hibernate.atlassian.net/browse/HHH-10472 about
this a while ago. But thinking about it again, I realize it actually
could be made work, although it doesn't appear as a desirable mapping
and I'd prefer an early error message.
Any thoughts?
Thanks,
--Gunnar
8 years, 9 months
Running/Debugging tests on any database without the matrix-testing
by Vlad Mihalcea
Hi,
I pushed the PR that enables us to easily switch from one DB to another
during testing.
I summarized the whole process here
<https://developer.jboss.org/wiki/HowToRundebugTestsWithoutUsingTheHiberna...>
.
Because of a bug in Wiki platform (when I edit I see an old version and not
the current one), I'll add an extra option which I found the simplest of
all.
Considering I want to run a unit test on the hibernate-core and the current
hibernate.properties was generated for H2.
1. I usually delete
it: hibernate-orm\hibernate-core\target\resources\test\hibernate.properties
2. Then I run gradle processTestResources -Pdb=pgsql
3. Afterwards, I can simply run the test on my IDE and it will use
PostgreSQL
Let me know what you think.
Vlad
8 years, 9 months
[HSEARCH] Rename elasticsearch artifact
by Davide D'Alto
At the moment the elasticsearch integration artifactid is:
hibernate-search-backend-elasticsearch
Elasticsearch is actually more than just a backend (we use this term for
the jGroups and JMS integration). I think we should rename it to:
hibernate-search-elasticsearch
Thanks,
Davide
8 years, 9 months
HHH-8999/HHH-10413 and Comparable IDs
by Gail Badner
ExecutableList#add attempts to keep track of whether the Executable objects
are sorted. [1]
Except for entity insert actions (which use InsertActionSorter),
ExecutableList#add uses the following to determine if adding the current
Executable to the end invalidates the sort:
if ( previousLast != null && previousLast.compareTo( executable ) > 0 ) {
sorted = false;
}
EntityAction#compareTo compares the IDs for the current and previous
EntityAction if they have different entity names; similarly,
CollectionAction compares the collection keys for the current and previous
CollectionAction if they have different entity names.
In most cases, the ID class implements Comparable, although I don't know of
any requirement that says this needs to be true.
This breaks down when a byte[] ID is used as described by HHH-8999. The
reason is that AbstractTypeDescriptor#comparator is null because it is
assigned like this:
this.comparator = Comparable.class.isAssignableFrom( type )
? (Comparator<T>) ComparableComparator.INSTANCE
: null;
PrimitiveByteArrayTypeDescriptor does not override
AbstractTypeDescriptor#getComparator, so null is returned ultimately
causing a NullPointerException in AbstractStandardBasicType#compare:
public final int compare(Object x, Object y) {
return javaTypeDescriptor.getComparator().compare( (T) x, (T) y );
}
The same happens for PrimitiveCharacterArrayTypeDescriptor,
ByteArrayTypeDescriptor, and CharacterArrayTypeDescriptor. Are there others?
According to HHH-10413, this also affects version attributes.
Here are a couple of alternatives:
A) create comparators for PrimitiveCharacterArrayTypeDescriptor,
ByteArrayTypeDescriptor, and CharacterArrayTypeDescriptor.
B) Change AbstractTypeDescriptor#comparator to:
this.comparator = Comparable.class.isAssignableFrom( type )
? (Comparator<T>) ComparableComparator.INSTANCE
: IncomparableComparator.INSTANCE;
IncomparableComparator#compare always returns 0, so that comparison would
never invalidate the sort.
Does it make sense to sort Executable objects by an ID or collection key
that is an array? In other words, would such IDs be generated in a natural
order? If not, I think B) makes more sense.
Thoughts?
Thanks,
Gail
[1]
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src...
8 years, 9 months