Bytecode enhancement
by Steve Ebersole
See https://hibernate.onjira.com/browse/HHH-7667
I want to investigate expanding Hibernate's support for bytecode
enhancement. I can see 3 main fronts to this:
1) offloading map lookups from the PersistenceContext . Currently we
keep state associated with each entity in a map (a special type of map
called IdentityMap) on the PersistenceContext, keyed by the entity.
Profiling consistently shows these maps as a hot-spot. The main thing
we keep in the PersistenceContext in regards to the entity is called an
EntityEntry, which is kept in an IdentityMap<Object,EntityEntry> (again,
the entity is the key). So the thought here is to invert this from
`map.get( entity )` to something like `( (Enhanced) entity
).getEntityEntry()`
2) More performant dirty-checking. This already exists, to an extent,
in the current Hibernate bytecode. The idea being that we could use
"interception" within the enhanced entity to know when it becomes dirty.
Well, almost. What is missing is "deep checking of mutable state
fields". For example, an entity attribute of type Date that is
"changed" via entity.getSomeDate().setTime( ... ). The entity needs to
be found dirty here, because its "someDate" attribute value has changed,
but interception will not catch this. And I think this should be
configurable (whether the user wants us to perform "deep mutable state
checking"). We have all the pieces in place to handle this already
through Type.isMutable() as Hibernate already does a great job of
finding dirty fields in the most flexible manner. We just need to
determine how to best wire that up into enhancement.
3) Alternative means for lazy loading of entity state, meaning an
alternative to using proxies for the same purpose. This is different,
too, from the current enhancement capability of lazy loading of property
state. Lazy property loading is meant to delay loading of certain
field(s) until they are accessed.
Looking for input about how to best design this. First, is Javassist
the best choice? That is what we currently use for enhancement. Beyond
that, I am not a bytecode enhancement (by any stretch), so any
ideas/pointers are welcome.
Thanks.
--
steve(a)hibernate.org
http://hibernate.org
12 years, 2 months
Hibernate, Gradle and IDEA
by Steve Ebersole
I noticed that JetBrains is doing EAP releases of IDEA 12. I decided to
again bring to their attention the fact that their Gradle support does
not import projects like Hibernate O/RM. Just to be sure of that, I
went ahead and tried it once more....
So I got a fresh clone of the repo and asked IDEA to import it... and...
success! :)
Just a heads up
--
steve(a)hibernate.org
http://hibernate.org
12 years, 2 months
Links to CI jobs on hibernate.org
by Gunnar Morling
Hi all,
I just noticed that some links to the Hibernate Jenkins jobs on
hibernate.org seem to be missing or wrong.
More specifically, the link on the ORM project page points to the HV
build, while the "Build" menu entry is disabled for all other
sub-projects except Tools and Validator. Who would be the right one to
fix that?
Thanks,
--Gunnar
12 years, 2 months
Failing unit tests on metamodel branch
by Gail Badner
I'm seeing a bunch of core unit test failures on metamodel branch. Is anyone looking into these?
org.hibernate.test.ops.SaveOrUpdateTest > testEvictThenSaveOrUpdate FAILED
java.lang.AssertionError at SaveOrUpdateTest.java:467
org.hibernate.test.discriminator.DiscriminatorTest > testAccessAsIncorrectSubclass FAILED
org.hibernate.exception.SQLGrammarException at DiscriminatorTest.java:137
Caused by: org.h2.jdbc.JdbcSQLException at DiscriminatorTest.java:137
org.hibernate.test.discriminator.DiscriminatorTest > testDiscriminatorSubclass FAILED
org.hibernate.exception.SQLGrammarException at DiscriminatorTest.java:86
Caused by: org.h2.jdbc.JdbcSQLException at DiscriminatorTest.java:86
org.hibernate.test.discriminator.DiscriminatorTest > testLoadSuperclassProxyEvictPolymorphicAccess FAILED
org.hibernate.exception.SQLGrammarException at DiscriminatorTest.java:258
Caused by: org.h2.jdbc.JdbcSQLException at DiscriminatorTest.java:258
org.hibernate.test.discriminator.DiscriminatorTest > testLoadSuperclassProxyPolymorphicAccess FAILED
org.hibernate.exception.SQLGrammarException at DiscriminatorTest.java:214
Caused by: org.h2.jdbc.JdbcSQLException at DiscriminatorTest.java:214
org.hibernate.test.discriminator.DiscriminatorTest > testQuerySubclassAttribute FAILED
org.hibernate.exception.SQLGrammarException at DiscriminatorTest.java:173
Caused by: org.h2.jdbc.JdbcSQLException at DiscriminatorTest.java:173
org.hibernate.test.bidi.AuctionTest2 > testLazy FAILED
org.hibernate.exception.SQLGrammarException at AuctionTest2.java:83
Caused by: org.h2.jdbc.JdbcSQLException at AuctionTest2.java:83
org.hibernate.test.where.WhereTest > testWhere FAILED
java.lang.AssertionError at WhereTest.java:62
org.hibernate.test.annotations.cid.keymanytoone.EagerKeyManyToOneTest > testLoadEntityWithEagerFetchingToKeyManyToOneReferenceBackToSelf FAILED
org.hibernate.testing.junit4.CallbackException
Caused by: java.lang.IllegalStateException
org.hibernate.test.version.VersionTest > testCollectionNoVersion FAILED
org.hibernate.exception.ConstraintViolationException at VersionTest.java:150
Caused by: org.h2.jdbc.JdbcSQLException at VersionTest.java:150
org.hibernate.test.version.VersionTest > testCollectionVersion FAILED
java.lang.AssertionError at VersionTest.java:105
org.hibernate.test.naturalid.immutable.ImmutableEntityNaturalIdTest > testSaveParentWithDetachedChildren FAILED
org.hibernate.exception.ConstraintViolationException at ImmutableEntityNaturalIdTest.java:134
Caused by: org.h2.jdbc.JdbcSQLException at ImmutableEntityNaturalIdTest.java:134
org.hibernate.test.cascade.BidirectionalOneToManyCascadeTest > testSaveChildWithParent FAILED
java.lang.AssertionError at BidirectionalOneToManyCascadeTest.java:100
org.hibernate.test.cascade.BidirectionalOneToManyCascadeTest > testSaveOrphanDeleteChildWithParent FAILED
java.lang.AssertionError at BidirectionalOneToManyCascadeTest.java:155
org.hibernate.test.cascade.BidirectionalOneToManyCascadeTest > testSaveParentWithChild FAILED
java.lang.AssertionError at BidirectionalOneToManyCascadeTest.java:74
org.hibernate.test.cascade.BidirectionalOneToManyCascadeTest > testSaveParentWithOrphanDeleteChild FAILED
java.lang.AssertionError at BidirectionalOneToManyCascadeTest.java:128
org.hibernate.test.cascade.CascadeTestWithAssignedParentIdTest > testSaveChildWithParent FAILED
java.lang.AssertionError at CascadeTestWithAssignedParentIdTest.java:69
org.hibernate.test.nonflushedchanges.SaveOrUpdateTest > testEvictThenSaveOrUpdate FAILED
java.lang.AssertionError at SaveOrUpdateTest.java:525
org.hibernate.test.readonly.ReadOnlyVersionedNodesTest > testAddNewChildToReadOnlyParent FAILED
java.lang.AssertionError at ReadOnlyVersionedNodesTest.java:293
org.hibernate.test.readonly.ReadOnlyVersionedNodesTest > testGetParentMakeReadOnlyThenMergeDetachedParentWithNewChildC FAILED
java.lang.AssertionError at ReadOnlyVersionedNodesTest.java:429
org.hibernate.test.readonly.ReadOnlyVersionedNodesTest > testMergeDetachedParentWithNewChildCommitWithReadOnlyParent FAILED
java.lang.AssertionError at ReadOnlyVersionedNodesTest.java:380
org.hibernate.test.readonly.ReadOnlyVersionedNodesTest > testMergeUnchangedDetachedParentChildren FAILED
java.lang.AssertionError at ReadOnlyVersionedNodesTest.java:493
org.hibernate.test.readonly.ReadOnlyVersionedNodesTest > testUpdateParentWithNewChildCommitWithReadOnlyParent FAILED
java.lang.AssertionError at ReadOnlyVersionedNodesTest.java:333
org.hibernate.metamodel.internal.source.AssertSourcesTest > testUserEntitySources FAILED
java.lang.AssertionError at AssertSourcesTest.java:107
org.hibernate.metamodel.internal.source.annotations.entity.TemporalBindingTest > testNoTemporalAnnotationOnTemporalTypeAttribute FAILED
java.lang.AssertionError
org.hibernate.metamodel.internal.source.annotations.entity.NaturalIdBindingTests > testAssociationNaturalIdBinding FAILED
java.lang.AssertionError at NaturalIdBindingTests.java:205
org.hibernate.metamodel.internal.source.annotations.entity.InheritanceBindingTest > testRootPolymporphism FAILED
junit.framework.AssertionFailedError at InheritanceBindingTest.java:168
org.hibernate.metamodel.spi.binding.BasicHbmBindingTests > testEntityWithManyToOneMapping FAILED
java.lang.AssertionError
3774 tests completed, 28 failed, 94 skipped
12 years, 2 months
Jira + GitHub
by Steve Ebersole
Hey everyone. A few months ago we had moved Hibernate Jira from using
FishEye to link in commits against GitHub to using Atlassian's "DVCS
Connector" plugin. Not even sure how many of you were aware but we had
been having a few problems with it (mainly not all commits showing up
automatically). I have been working with Atlassian to try and get that
corrected. Today we think those problems are all resolved.
If you notice any pushed commits that do not show up on the commits tab in
the Jira issue please let me know.
12 years, 2 months
hibernate-commons-annotations dependencies
by Guillaume Smet
Hi,
I don't know what is your policy about the dependency management but,
currently, when you include hibernate-entity-manager in the pom of an
application, it comes with dependencies to 3.1.0.Final and 3.1.0.CR2.
The problem is that hibernate-commons-annotations-4.0.1.Final requires
3.1.0.CR2 of jboss-logging. See:
http://search.maven.org/remotecontent?filepath=org/hibernate/common/hiber...
I was wondering if it was possible to add an exclusion to the
hibernate-entity-manager pom.xml (or the Gradle equivalent) to not
drag the jboss-logging dependency of hibernate-commons-annotations so
that from the outside the dependencies of hibernate-entity-manager are
clean.
Thanks for your feedback.
--
Guillaume
12 years, 2 months
Re: [hibernate-dev] hibernate-commons-annotations dependencies
by Guillaume Smet
On Mon, Oct 8, 2012 at 7:03 PM, Steve Ebersole
<steven.ebersole(a)gmail.com> wrote:
> We are not going to get into the business of releasing projects just for new
> releases of dependencies. Thats not manageable.
Totally agree on this point. That's why I suggested to add an exclusion.
That said, I'm not sure the problem is worth the bandwidth. I didn't
want to start such a long thread for such a minor issue.
--
Guillaume
12 years, 2 months
OGM: question/issue with updateTuple() and embeddable objects with custom column name
by Tugdual Grall
Hi,
I am developing a new Datastore for Couchbase and have a issue/question
with the Embeddable support. Since I am new to OGM I prefer to ask the
question to the expert before login an issue. (and did not find this issue
in JIRA)
For my example I am using the model described in the Embeddable test:
https://github.com/hibernate/hibernate-ogm/tree/master/hibernate-ogm-core...
During the process of creating a new Account, with an Address OGM is
calling the updateTuple, and when the Embeddable tupe has a custom column
name.
In the Address entity I see the following code:
...
@Column(name = "postal_code")
public String getZipCode() { return zipCode; }
....
The updateTuple() method received the following columnName:
postal_code
Where it should be something like:
homeAddress.postal_code
This is what happens when the column is not renamed: homeAddress.zipCode
Could you please confirm that it is a bug? (or what I am doing wrong)
PS: I have started to dive into the code to find the source of the issue...
will continue as soon as I have the green light to enter a JIRA.
Tug the newbie
12 years, 2 months
Re: [hibernate-dev] Documentation on OGM + JBoss AS
by Scott Marlow
Regarding the project explosion part, we don't have a strong need to have a separate "module packaging" solution. Creating module packages in the OGM project sounds like a good way.
Having said that, I still want to continue adding persistence provider specific integration code to the AS project and find a good home for that code.
Sent from my tardis
-----Original Message-----
From: Emmanuel Bernard [emmanuel(a)hibernate.org]
Received: Friday, 05 Oct 2012, 6:38pm
To: Scott Marlow [smarlow(a)redhat.com]
CC: Sanne Grinovero [sanne(a)hibernate.org]; Hibernate Dev [hibernate-dev(a)lists.jboss.org]
Subject: Re: [hibernate-dev] Documentation on OGM + JBoss AS
If that does not slow down the test suite significantly, I'd favor a module to limit project explosion.
On 5 oct. 2012, at 06:56, Scott Marlow <smarlow(a)redhat.com> wrote:
> On 10/05/2012 06:16 AM, Sanne Grinovero wrote:
>> Thanks Scott, that documentation arrived just in time:
>> https://forum.hibernate.org/viewtopic.php?f=31&t=1024476
>>
>> It looks like we could simplify things by creating an AS7 module, and
>> release it in tandem with an OGM release.
>>
>> What could be the best way to distribute this module?
>
> A few different ways that we could proceed. In the OGM project, we could assemble an AS7 module that is ready to drop into the AS7 root folder. This wouldn't include the OGM integration code module (which we haven't needed to write but could to make it easier to use OGM with AS7).
>
> Another way, would be to start a new project that packages the OGM provider into a ready to use AS7 module. We could also package the OGM integration code (persistence provider adapter) in this new project.
>
>>
>> Is there a "clean" way to create one? (by "clean" I mean possibly not
>> relying on the Maven assembly plugin, and more importantly making
>> something which can be tested in automation)
>
> If we create a new project for this, I'm open to suggestions for how to create the module from within the project (whether its with Maven, Ant, Ivy or something else).
>
>>
>> Sanne
>>
>>
>> On 1 October 2012 23:21, Sanne Grinovero <sanne(a)hibernate.org> wrote:
>>> You don't have to build it but having it in the cache woud help :)
>>>
>>> The test is building and materializing an AS7 module on the filesystem
>>> containing all dependencies, including Hibernate Search (among others)
>>> and uses ShrinkWrap to do that; if you look in the test you should
>>> find a line which forces it to stay offline (as it was massively slow
>>> otherwise), you should comment that line at least once so that it
>>> downloads all what it needs.
>>>
>>> On 1 October 2012 19:39, Scott Marlow <smarlow(a)redhat.com> wrote:
>>>> On 10/01/2012 12:23 PM, Sanne Grinovero wrote:
>>>>>
>>>>> On 1 October 2012 17:08, Scott Marlow <smarlow(a)redhat.com> wrote:
>>>>>>
>>>>>> On 10/01/2012 11:05 AM, Sanne Grinovero wrote:
>>>>>>>
>>>>>>>
>>>>>>> On 1 October 2012 15:51, Scott Marlow <smarlow(a)redhat.com> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> I got further yesterday (after removing the ---PlaceHolderDSForOGM---
>>>>>>>> property from HibernateOgmPersistence). Not sure what the long term
>>>>>>>> change is (perhaps we should only add the ---PlaceHolderDSForOGM--- for
>>>>>>>> the non-container case).
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Nice. Is the AS still "mandating" a specific module name and injecting
>>>>>>> Hibernate 3?
>>>>>>
>>>>>>
>>>>>>
>>>>>> The OGM module name should be org.hibernate:ogm. The org.hibernate:ogm
>>>>>> module should depend on Hibernate 4 (org.hibernate:main) and Hibernate 4
>>>>>> should depend on OGM.
>>>>>
>>>>>
>>>>> I'm still not understanding why we need to hardcode a constant module
>>>>> name for the OGM provider, that's unintuitive and brought me a lot of
>>>>> pain when trying to use a *different* version, when recently trying
>>>>> out your instructions.
>>>>>
>>>>> I might want to deploy OGM using a different version of Hibernate ORM
>>>>> than what I have in another OGM-using application; also it is very
>>>>> likely that soon OGM will require a version which is not the one
>>>>> bundled in the AS.
>>>>>
>>>>> I would expect the module to be something I can configure in my own
>>>>> application:
>>>>>
>>>>>
>>>>> https://github.com/Sanne/ogm-kitchensink/blob/as711/src/main/webapp/WEB-I...
>>>>>
>>>>> it should be possible to use a different module name, how could I deal
>>>>> with multiple deployments otherwise? The AS should not mandate the
>>>>> module dependency, at best it could take some hint like you do with
>>>>> the _jboss.as.jpa.adapterModule_ property
>>>>>
>>>>>
>>>>> https://github.com/Sanne/ogm-kitchensink/blob/as711/.openshift/config/mod...
>>>>>
>>>>> I didn't need any datasource, this worked fine:
>>>>>
>>>>> https://github.com/Sanne/ogm-kitchensink/blob/as711/src/main/resources/ME...
>>>>
>>>>
>>>> I tried building https://github.com/Sanne/ogm-kitchensink (as711 branch)
>>>> locally but got an error:
>>>>
>>>> Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: The
>>>> repository system is offline but the artifact
>>>> org.hibernate:hibernate-search-orm:jar:4.1.1.Final is not available in the
>>>> local repository.
>>>>
>>>> Do I need to build search locally to use this example?
>>>>
>>>>
>>>>>
>>>>> Sanne
>>>>>
>>>>>>> Last time I was trying that was driving me nuts, as to workaround it I
>>>>>>> needed lots of changes in AS.
>>>>>>
>>>>>>
>>>>>>
>>>>>> We should either create a blog update to explain this or as previously
>>>>>> discussed on this thread, document the changes needed.
>>>>>>
>>>>>> http://pastie.org/4891854 is my current persistence.xml that I'm testing
>>>>>> with.
>>>>>>
>>>>>> I had to set jboss.as.jpa.adapterModule to org.jboss.as.jpa.hibernate:4,
>>>>>> so
>>>>>> that we would use the Hibernate 4 integration code with OGM.
>>>>>>
>>>>>> I also had to set jboss.as.jpa.classtransformer to false so that we
>>>>>> wouldn't
>>>>>> try to create the EntityManagerFactory too soon (should probably verify
>>>>>> if
>>>>>> that is still needed).
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> I would expect to not have any OGM-specific code in the AS, but that
>>>>>>> it should be good enough to implement the JPA spec correctly regarding
>>>>>>> the provider implementation?
>>>>>>
>>>>>>
>>>>>>
>>>>>> I sometimes hear that question (why don't you just use the JPA spec
>>>>>> bootstrapping). However, we are allowed by the JPA specification, to
>>>>>> pass a
>>>>>> map of integration properties when calling the
>>>>>>
>>>>>> PersistenceProvider.createContainerEntityManagerFactory(PersistenceUnitInfo,
>>>>>> Map integrationProperties) call. Sometimes, the persistence providers
>>>>>> include enough version specific application server integration code, so
>>>>>> that
>>>>>> app servers find that its good enough to just call the JPA spec
>>>>>> invocation
>>>>>> but in practice this breaks when the app servers change too much.
>>>>>>
>>>>>> For AS7, I created persistence provider adapters that (optionally)
>>>>>> contain
>>>>>> the extra integration code that is not handled by the JPA specification.
>>>>>> For AS 8.0, I want to change the relationship between the persistence
>>>>>> provider adapters and providers to be less tightly coupled (its currently
>>>>>> a
>>>>>> 1-1) but they make developing JPA applications for AS7 easier for the
>>>>>> developer (fewer properties have to be passed in).
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> http://pastie.org/4891549 is the out from running one of the example
>>>>>>>> applications (jboss-javaee6-webapp). Obviously, I need to try a
>>>>>>>> different test. ;)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Right, you might need to simplify an existing test, or take the
>>>>>>> ogm-kitchensink as a starting point:
>>>>>>> take branch as711 from:
>>>>>>> git://github.com/Sanne/ogm-kitchensink.git
>>>>>>>
>>>>>>> Hardy originally wrote that demo, but I don't remember if we ever
>>>>>>> integrated my changes from that branch to have it run on AS 7.1.1.
>>>>>>>
>>>>>>>> For AS documentation, I'm not sure if we are ready to add that yet (it
>>>>>>>> would be experimental with the goal of helping someone get started).
>>>>>>>> I'm open to suggestions but I think we could build on what I blogged
>>>>>>>> about last year here
>>>>>>>>
>>>>>>>>
>>>>>>>> http://in.relation.to/Bloggers/UsingADifferentPersistenceProviderWithAS70....
>>>>>>>>
>>>>>>>> - How to add the OGM module to AS
>>>>>>>> - Changing existing AS module dependencies for OGM
>>>>>>>> - Infinispan Configuration changes for OGM
>>>>>>>> - Example
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> That would be great, are you creating a patch for the docbook in OGM?
>>>>>>
>>>>>>
>>>>>>
>>>>>> I created a git branch locally but haven't started the actual doc changes
>>>>>> yet.
>>>>>>
>>>>>> Scott
>>>>>>
>>>>>>>
>>>>>>> Sanne
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 09/27/2012 11:13 AM, Emmanuel Bernard wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I'd still prefer a small section in our reference documentation.
>>>>>>>>> Stuff in the wiki is as useful as peeing in a violin as we say in
>>>>>>>>> France ;)
>>>>>>>>>
>>>>>>>>> Emmanuel
>>>>>>>>>
>>>>>>>>> On Thu 2012-09-27 9:52, Scott Marlow wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 09/27/2012 09:02 AM, Emmanuel Bernard wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Hey Scott,
>>>>>>>>>>>
>>>>>>>>>>> I stumbled upon https://hibernate.onjira.com/browse/OGM-117 and
>>>>>>>>>>> wondered
>>>>>>>>>>> if you could contribute a paragraph or two on how to use Hibernate
>>>>>>>>>>> OGM
>>>>>>>>>>> in JBoss AS latest.
>>>>>>>>>>> The documentation is hosted in
>>>>>>>>>>> http://github.com/hibernate/hibernate-ogm, there
>>>>>>>>>>> is a documentation module.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I could do that or
>>>>>>>>>> https://docs.jboss.org/author/display/AS72/JPA+Reference+Guide might
>>>>>>>>>> be another place for the "how to use Hibernate OGM with AS"
>>>>>>>>>> documentation. This link is likely to change like the wind but the
>>>>>>>>>> content will be available.
>>>>>>>>>>
>>>>>>>>>> I'm not sure that either location is better, but I do like using
>>>>>>>>>> confluence as users can more easily fix the mistakes. ;)
>>>>>>>>>>
>>>>>>>>>> Do you have a preference?
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> If you can make it by end of week or Monday, you gain extra karma
>>>>>>>>>>> points.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Extra karma points are always good to have! :)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> hibernate-dev mailing list
>>>>>>>> hibernate-dev(a)lists.jboss.org
>>>>>>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>>>>
>>>>>>
>>>>>>
>>>>
>
12 years, 2 months