Session save not seen in query
sebastien.michea Feb 27, 2013 3:40 AMHello,
I use 3.1.2.Final on jboss 7.1.1
and i have a document type like this :
[nbe:document] > nt:file
- scannDate (DATE) mandatory COPY
- period (STRING) mandatory COPY
- journal (STRING) mandatory COPY
- status (STRING) mandatory COPY
- rejectionReason (STRING) COPY
- originalFilename (STRING) COPY
- originalMD5 (STRING) COPY
- pieces (REFERENCE) multiple COPY
When i create a document, i set its status to UPLOADED and it appears correctly in my queries.
Then i have a job that update its status to ACKNOLEDGED.
To create or update nodes i use a stateless bean with a locl instance of JCRSession. I save then logout of the session each time i create or update a node and instanciate a new session in the bean whenever the session is not live.
I can see using the rest or webdav app that the status of the node is indeed ACKNOLEDGED and this also appear when i query on status ACKNOLEDGED in my app.
The problem i encounter is that unless i restart my app the document will still appear when i query on statut UPLOADED (i use JCR-SQL2)
Its like when executing query the document is both in ACKNOLEDGED and UPLOADED state...
Here is the plan i can see in the JCRQueryResult.result.plan
Access [nbe:document]
Project [nbe:document] <PROJECT_COLUMN_TYPES=[DATE, STRING, STRING, STRING, STRING, STRING, STRING, REFERENCE, STRING, STRING, DATE, STRING, STRING, STRING, DOUBLE, STRING, LONG], PROJECT_COLUMNS=[[nbe:document].scannDate AS [nbe:document.scannDate], [nbe:document].period AS [nbe:document.period], [nbe:document].journal AS [nbe:document.journal], [nbe:document].status AS [nbe:document.status], [nbe:document].rejectionReason AS [nbe:document.rejectionReason], [nbe:document].originalFilename AS [nbe:document.originalFilename], [nbe:document].originalMD5 AS [nbe:document.originalMD5], [nbe:document].pieces AS [nbe:document.pieces], [nbe:document].[jcr:primaryType] AS [nbe:document.jcr:primaryType], [nbe:document].[jcr:mixinTypes] AS [nbe:document.jcr:mixinTypes], [nbe:document].[jcr:created] AS [nbe:document.jcr:created], [nbe:document].[jcr:createdBy] AS [nbe:document.jcr:createdBy], [nbe:document].[jcr:path] AS [nbe:document.jcr:path], [nbe:document].[jcr:name] AS [nbe:document.jcr:name], [nbe:document].[jcr:score] AS [nbe:document.jcr:score], [nbe:document].[mode:localName] AS [nbe:document.mode:localName], [nbe:document].[mode:depth] AS [nbe:document.mode:depth]]>
Select [nbe:document] <SELECT_CRITERIA=PATH([nbe:document]) LIKE '/accounts/NA02/documents/%'>
Select [nbe:document] <SELECT_CRITERIA=[nbe:document].period LIKE '%201302%'>
Select [nbe:document] <SELECT_CRITERIA=[nbe:document].status = 'UPLOADED'>
Select [nbe:document] <SELECT_CRITERIA=[nbe:document].[jcr:primaryType] = 'nbe:document'>
Source [nbe:document] <SOURCE_NAME=__ALLNODES__, SOURCE_ALIAS=nbe:document, SOURCE_COLUMNS=[jcr:frozenUuid(STRING), mode:sharedUuid(REFERENCE), mode:sessionScope(BOOLEAN), jcr:defaultValues(STRING), mode:projectedNodeKey(STRING), jcr:frozenPrimaryType(STRING), jcr:mixinTypes(STRING), jcr:defaultPrimaryType(STRING), datePiece(DATE), documents(REFERENCE), rejectionReason(STRING), noFacture(STRING), comptable(STRING), jcr:statement(STRING), jcr:lastModifiedBy(STRING), jcr:mimeType(STRING), originalFilename(STRING), jcr:hasOrderableChildNodes(BOOLEAN), jcr:etag(STRING), typePiece(STRING), jcr:encoding(STRING), jcr:root(REFERENCE), jcr:supertypes(STRING), jcr:successors(REFERENCE), jcr:primaryItemName(STRING), scannDate(DATE), jcr:hold(STRING), jcr:workspace(STRING), jcr:description(STRING), jcr:primaryType(STRING), mode:initializationState(STRING), tiers(STRING), mode:externalNodeKey(STRING), mode:derivedFrom(STRING), mode:isHeldBySession(BOOLEAN), jcr:baseVersion(REFERENCE), jcr:lastModified(DATE), jcr:mergeFailed(REFERENCE), jcr:requiredPrimaryTypes(STRING), mode:derivedAt(DATE), jcr:multiple(BOOLEAN), mode:generated(BOOLEAN), jcr:activityTitle(STRING), jcr:lifecyclePolicy(REFERENCE), jcr:isMixin(BOOLEAN), devise(STRING), jcr:availableQueryOperators(STRING), jcr:childVersionHistory(REFERENCE), jcr:autoCreated(BOOLEAN), jcr:content(REFERENCE), period(STRING), mode:alias(STRING), jcr:createdBy(STRING), jcr:isFullTextSearchable(BOOLEAN), jcr:uuid(STRING), jcr:onParentVersion(STRING), journal(STRING), mode:expirationDate(DATE), jcr:lockIsDeep(BOOLEAN), jcr:isDeep(BOOLEAN), jcr:copiedFrom(REFERENCE), dateTransmission(DATE), jcr:title(STRING), jcr:isAbstract(BOOLEAN), jcr:versionHistory(REFERENCE), jcr:versionableUuid(STRING), refGED(STRING), jcr:predecessors(REFERENCE), jcr:lockOwner(STRING), status(STRING), exercice(STRING), mode:sha1(STRING), jcr:repository(STRING), jcr:created(DATE), jcr:frozenMixinTypes(STRING), mode:lockedKey(STRING), jcr:text(STRING), jcr:host(STRING), jcr:configuration(REFERENCE), jcr:port(STRING), mode:workspace(STRING), pieces(REFERENCE), jcr:nodeTypeName(STRING), originalMD5(STRING), jcr:isQueryable(BOOLEAN), jcr:data(BINARY), jcr:language(STRING), jcr:isQueryOrderable(BOOLEAN), jcr:isCheckedOut(BOOLEAN), jcr:mandatory(BOOLEAN), jcr:protected(BOOLEAN), jcr:protocol(STRING), jcr:sameNameSiblings(BOOLEAN), jcr:requiredType(STRING), montantTTC(STRING), mode:lockingSession(STRING), jcr:messageId(STRING), mois(STRING), jcr:id(REFERENCE), mode:uri(STRING), jcr:valueConstraints(STRING), jcr:retentionPolicy(REFERENCE), jcr:activity(REFERENCE), dateEcheance(DATE), libelle(STRING), jcr:currentLifecycleState(STRING), jcr:path(STRING), jcr:name(STRING), jcr:score(DOUBLE), mode:localName(STRING), mode:depth(LONG)]>
And the result i get in JCRQueryResult.result.tuple
[2013-02-13T00:00:00.000+01:00, 201302, AC, ACKNOWLEDGED, null, C:\tmp\data\docs\20130213\NA02\20130213_PM_NA02_AC_201302_00234.pdf, null, null, {http://www.business-expert.com/jcr/nbe/1.0}document, [Ljava.lang.Object;@65312b7c, 2013-02-27T08:21:43.090+01:00, admin, /{}accounts/{}NA02/{}documents/{}201302/{}AC/{}20130213_PM_NA02_AC_201302_00234.pdf, {}20130213_PM_NA02_AC_201302_00234.pdf, null, 20130213_PM_NA02_AC_201302_00234.pdf, 6, /{}accounts/{}NA02/{}documents/{}201302/{}AC/{}20130213_PM_NA02_AC_201302_00234.pdf @ 6b001687505d64a111fe4a-6291-4db4-8c08-f7499ec7d9be, 2.455288887023926]
here is my standalone.xml
<cache-container name="modeshape">
<local-cache name="nbeportal">
<transaction mode="NON_XA"/>
<file-store relative-to="jboss.server.data.dir" path="modeshape/store/nbeportal" passivation="false" purge="false"/>
</local-cache>
</cache-container>
<security-domain name="modeshape-security" cache-type="default">
<authentication>
<login-module code="UsersRoles" flag="required">
<module-option name="usersProperties" value="modeshape-users.properties"/>
<module-option name="rolesProperties" value="modeshape-roles.properties"/>
</login-module>
</authentication>
</security-domain>
<subsystem xmlns="urn:jboss:domain:modeshape:1.0">
<repository name="nbeportal" cache-name="nbeportal" cache-container="modeshape">
<indexing rebuild-upon-startup="ALWAYS"/>
</repository>
</subsystem>
Here what i tried until now, without success :
- do not loggout of the session (i cant see what is the effect of logging out)
- change the stateless bean to a singleton
- put the session object static
- call the rebuildIndex method after update is performed
I'm bit stuck here and for now we have to restart the production server after any update ... any idea ?
Also some more generic questions:
- As you see i rebuild all the indexes at startup (if not my queries just cant see anything in the repo, even the webdav or rest app tell me the repo is empty)... i guess i should not do that and might have to store indexes in files or somewhere but i dont really understand how this works.
- When we perform tests we often have to clear the repository, for this we delete everything in data/modeshape/store is that the correct way ?
Thank you in advance