[seam-dev] Re: Hibernate search 3.1.1.GA w/ seam
Sanne Grinovero
sanne.grinovero at gmail.com
Sun Jun 28 07:45:27 EDT 2009
Some more investigation about JBSEAM-4257:
I did a svn-diff from Seam 2.1.2 which was fine with this test to 2.2,
which is failing.
As no code has changed regarding transaction handling I did some more
tests and discovered that I was wrong about the transaction being not
committed: there is no transaction at all.
Emmanuel, I got tricked by my own code from [HSEARCH-178 : Out of
transaction work causes collection lazy loading to throw
AssertionFailure] you remember to workaround flushing out of
transaction Search is now "faking" a transaction, creating a
TransactionalWorker bound to a flush listener, instead of performing
the work immediately as previous versions.
This led me to think yesterday that I actually was in a transaction.
So now I've verified that the transaction was missing in Seam 2.1.2
too, but in that case using Search 3.0.1 when there is no transaction
the work is immediately done and not postponed, so the flush or commit
were not needed for the example to work correctly.
To use flushToIndexes() is a workaround for JBSEAM-4257, if fixing
JBSEAM-4278 is not possible now.
Please can someone comment about JBSEAM-4278? If it can't be fixed
soon I think that JBSEAM-4257 could be closed as the workaround is
applied already.
regards,
Sanne
2009/6/27 Sanne Grinovero <sanne.grinovero at gmail.com>:
> I've been stepping through the blog example with a debugger to look
> into JBSEAM-4257;
> the transaction is fine but it appears that it doesn't get to commit
> after the method invocation.
>
> If I convert the component to a @Stateful bean *and* change the "@In
> FullTextEntityManager" into
> a "@PersistenceContext EntityManager" it does work: the transaction is
> committed and the test
> succeeds.
> If I only convert the pojo into a Stateful bean and keep using "@In"
> to inject entitymanager, it doesn't
> inject and the method is called having null EntityManager -> NPE.
>
> The dvdstore example is not affected by this, as the indexer
> implementation of dvdstore
> is using a @Stateful bean and @PersistenceContext already.
>
> The problem is the @Create annotated method combined with @Startup and
> @Scope(ScopeType.APPLICATION):
> if I remove @Startup and have the method called before the first
> search (I experimented having it injected with create=true in the
> search
> service) the behaviour is correct: the transaction is committed, the
> index is updated and the search results are fine.
>
> I've opened JBSEAM-4278 for this; should I open a second one for the
> missing injections in EJB3 stateful beans?
> I'm not sure if it the same issue, I mentioned it in the description.
>
> Sanne
>
>
> 2009/6/26 Emmanuel Bernard <emmanuel at hibernate.org>:
>> That's a problem. We need to understand why no tx is enlisted from an
>> hibernate pov. Looks like a config bug or something more severe on the
>> hibernate side.
>>
>> On 26 juin 2009, at 01:09, Sanne Grinovero <sanne.grinovero at gmail.com>
>> wrote:
>>
>>> Hi Norman, Emmanuel,
>>> I think it was working for Norman in JBoss because it somehow used the
>>> existing index, as the blog example was not doing cleanup;
>>> removing the index I verified it behaves the same when deployed or with
>>> testNG.
>>>
>>> I've attached a patch here to remove existing data from the index at
>>> startup (purgeAll) and making sure the new data
>>> is flushed to the index (entityManager.flushToIndexes();).
>>>
>>> This makes the test succeed, but I'm unsure about this being the
>>> proper fix. Emmanuel, WDYT? I was not expecting
>>> to have the flushToIndexes being mandatory... it appears there is no
>>> transaction committed by Seam?
>>> The dvdstore is using a similar indexing routine, and it appears to be
>>> working fine even withouth the flush.
>>>
>>> greetings,
>>> Sanne
>>>
>>>
>>> 2009/6/24 Sanne Grinovero <sanne.grinovero at gmail.com>:
>>>>
>>>> Hello,
>>>> I can look into this on friday 26, is that a good time?
>>>>
>>>> Sanne
>>>>
>>>> 2009/6/24 Emmanuel Bernard <emmanuel at hibernate.org>:
>>>>>
>>>>> My machine crashed yesterday so I won't be able to look into that.
>>>>> Sanne probably can help as he has done the latest Hibernate migration in
>>>>> Seam.
>>>>> Or maybe Hardy.
>>>>>
>>>>> Emmanuel
>>>>>
>>>>> On Jun 23, 2009, at 06:57, Emmanuel Bernard wrote:
>>>>>
>>>>>> Damn I'm on the road this week.
>>>>>> Can you give me the SVN url for me to reproduce?
>>>>>>
>>>>>> That must be a dump thing.
>>>>>>
>>>>>> On Jun 23, 2009, at 02:59, Norman Richards wrote:
>>>>>>
>>>>>>> We've upgraded Hibernate search for Seam 2.2, but we're getting one
>>>>>>> small
>>>>>>> issue with it when running unit tests with the blog example:
>>>>>>>
>>>>>>> https://jira.jboss.org/jira/browse/JBSEAM-4257
>>>>>>>
>>>>>>> I tracked it down to being an issue with the index directory not
>>>>>>> getting
>>>>>>> correctly populated. If I copy the index directory from the blog
>>>>>>> example
>>>>>>> running in jboss, everything works fine. Any ideas why the index
>>>>>>> wouldn't
>>>>>>> be created correctly?
>>>>>>>
>>>>>>> Specifically, what is created during unit tests is:
>>>>>>>
>>>>>>> $ ls -al domain.BlogEntry/
>>>>>>> total 16
>>>>>>> drwxr-xr-x 4 orb staff 136 Jun 22 19:19 .
>>>>>>> drwxr-xr-x 3 orb staff 102 Jun 22 19:19 ..
>>>>>>> -rw-r--r-- 1 orb staff 20 Jun 22 19:19 segments.gen
>>>>>>> -rw-r--r-- 1 orb staff 28 Jun 22 19:19 segments_1
>>>>>>>
>>>>>>>
>>>>>>> whereas when running in AS, I get:
>>>>>>>
>>>>>>> burrito:blogindexes orb$ ls -al domain.BlogEntry
>>>>>>> total 168
>>>>>>> drwxr-xr-x 19 orb staff 646 Jun 9 14:32 .
>>>>>>> drwxr-xr-x 3 orb staff 102 Jun 3 15:19 ..
>>>>>>> -rw-r--r-- 1 root staff 6027 Jun 9 13:15 _2s.cfs
>>>>>>> -rw-r--r-- 1 root staff 9 Jun 9 13:52 _2s_3.del
>>>>>>> -rw-r--r-- 1 root staff 4818 Jun 9 13:15 _2t.cfs
>>>>>>> -rw-r--r-- 1 root staff 9 Jun 9 13:52 _2t_1.del
>>>>>>> -rw-r--r-- 1 root staff 1121 Jun 9 13:15 _2u.cfs
>>>>>>> -rw-r--r-- 1 root staff 9 Jun 9 13:52 _2u_1.del
>>>>>>> -rw-r--r-- 1 root staff 976 Jun 9 13:52 _2v.cfs
>>>>>>> -rw-r--r-- 1 orb staff 9 Jun 9 14:32 _2v_1.del
>>>>>>> -rw-r--r-- 1 root staff 4818 Jun 9 13:52 _2w.cfs
>>>>>>> -rw-r--r-- 1 orb staff 9 Jun 9 14:32 _2w_1.del
>>>>>>> -rw-r--r-- 1 root staff 1121 Jun 9 13:52 _2x.cfs
>>>>>>> -rw-r--r-- 1 orb staff 9 Jun 9 14:32 _2x_1.del
>>>>>>> -rw-r--r-- 1 orb staff 976 Jun 9 14:32 _2y.cfs
>>>>>>> -rw-r--r-- 1 orb staff 4818 Jun 9 14:32 _2z.cfs
>>>>>>> -rw-r--r-- 1 orb staff 1121 Jun 9 14:32 _30.cfs
>>>>>>> -rw-r--r-- 1 orb staff 20 Jun 9 14:32 segments.gen
>>>>>>> -rw-r--r-- 1 orb staff 254 Jun 9 14:32 segments_8r
>>>>>>>
>>>>>>> If you can even give me some idea what code to look at, it would be a
>>>>>>> great help. Thanks.
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>> <examples-blog.diff>
>>
>
More information about the seam-dev
mailing list