How search DLFileEntry/DLFileVersion with specific metadata values?How search DLFileEntry/DLFileVersion with specific metadata values?https://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1131218402024-03-29T08:34:48Z2024-03-29T08:34:48ZRE: How search DLFileEntry/DLFileVersion with specific metadata values?Marco Azzalinihttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1131830312019-04-12T07:48:57Z2019-04-12T07:48:57Z<blockquote>Jorge DíazHi Marco,<br /><br /> com.liferay.portlet.documentlibrary.model.impl.DLFileEntryMetadataImpl extends com.liferay.portlet.documentlibrary.model.impl.DLFileEntryMetadataModelImpl<br /><br /><br />I have checked that class and it seems property is called <strong>DDMStorageId</strong>, with DDM in uppercase, see:<ul style="list-style: disc outside;"><li><a href="https://github.com/liferay/liferay-portal/blob/7.1.x/portal-impl/src/com/liferay/portlet/documentlibrary/model/impl/DLFileEntryMetadataModelImpl.java#L66-L71">https://github.com/liferay/liferay-portal/blob/7.1.x/portal-impl/src/com/liferay/portlet/documentlibrary/model/impl/DLFileEntryMetadataModelImpl.java#L66-L71</a></li></ul><br />Can you try using that property name?<br /><br />I hope that solves your problem, as I am running out of ideas.<br /><br />In case that doesn't solve your issue, can you attach your whole log file with the error?<br /><br />Regards,<br />Jorge Díaz</blockquote>Jorge, with DDMStorageId it works!!<br /><br />I think this should be definly better documented, but thank you very much for all your support! <br /><br />regards,<br />MarcoMarco Azzalini2019-04-12T07:48:57ZRE: How search DLFileEntry/DLFileVersion with specific metadata values?Jorge Diazhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1131480622019-04-11T13:51:29Z2019-04-11T13:51:29ZHi Marco,<br /><br /> com.liferay.portlet.documentlibrary.model.impl.DLFileEntryMetadataImpl extends com.liferay.portlet.documentlibrary.model.impl.DLFileEntryMetadataModelImpl<br /><br /><br />I have checked that class and it seems property is called <strong>DDMStorageId</strong>, with DDM in uppercase, see:<ul style="list-style: disc outside;"><li><a href="https://github.com/liferay/liferay-portal/blob/7.1.x/portal-impl/src/com/liferay/portlet/documentlibrary/model/impl/DLFileEntryMetadataModelImpl.java#L66-L71">https://github.com/liferay/liferay-portal/blob/7.1.x/portal-impl/src/com/liferay/portlet/documentlibrary/model/impl/DLFileEntryMetadataModelImpl.java#L66-L71</a></li></ul><br />Can you try using that property name?<br /><br />I hope that solves your problem, as I am running out of ideas.<br /><br />In case that doesn't solve your issue, can you attach your whole log file with the error?<br /><br />Regards,<br />Jorge DíazJorge Diaz2019-04-11T13:51:29ZRE: How search DLFileEntry/DLFileVersion with specific metadata values?Marco Azzalinihttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1131380312019-04-11T11:32:09Z2019-04-11T11:32:09ZNo, never tried before...<br /><br />but same result :-(<br /><br />SystemException: org.hibernate.QueryException: could not resolve property: ddmStorageId of: com.liferay.portlet.documentlibrary.model.impl.DLFileEntryMetadataImplMarco Azzalini2019-04-11T11:32:09ZRE: How search DLFileEntry/DLFileVersion with specific metadata values?Jorge Diazhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1131352852019-04-11T10:50:35Z2019-04-11T10:50:35ZDid you tried using camel case in the property name?<br /><br />I mean to use "ddmStorageId" instead of "ddmstorageid"Jorge Diaz2019-04-11T10:50:35ZRE: How search DLFileEntry/DLFileVersion with specific metadata values?Marco Azzalinihttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1131347232019-04-11T10:35:35Z2019-04-11T10:35:35Z<html><head></head><body>Hi Jorge, I did what you suggested me and now my code is:<br><pre><code>q=DLFileEntryMetadataLocalServiceUtil.dynamicQuery();
q.add(PropertyFactoryUtil.forName("ddmstorageid").in(ddmContentsIdsArray));
List<dlfileentrymetadata> fileEntryMetadataList= DLFileEntryMetadataLocalServiceUtil.dynamicQuery(q);</dlfileentrymetadata></code></pre><br>but the same exception is raised :-(<br>I did also more investigation and the error occours with any property so I am agree with you that the problem could be something related with class loading but I really can't figure out what difference could be between DDMContent (where the same query run smootly) and DLFileentryMetadata ...<br><br>This is really weird...</body></html>Marco Azzalini2019-04-11T10:35:35ZRE: How search DLFileEntry/DLFileVersion with specific metadata values?Jorge Diazhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1131316942019-04-11T07:57:59Z2019-04-11T07:57:59Z<html><head></head><body>Hi Marco,<br><br>I think you have some problem with classloaders. <br>See following link: <a href="https://community.liferay.com/forums/-/message_boards/message/98752117#_com_liferay_message_boards_web_portlet_MBPortlet_message_92981243">https://community.liferay.com/forums/-/message_boards/message/98752117#_com_liferay_message_boards_web_portlet_MBPortlet_message_92981243<br><br></a><br>Try replacing <strong><em>DynamicQueryFactoryUtil.forClass({className}.class)</em></strong> with<br><pre><code>{className}LocalServiceUtil.dynamicQuery()</code></pre>That will avoid classloader issues<br><br>For examine, in case of DLFileEntryMetadata, replace <em><strong>DynamicQueryFactoryUtil.forClass(DLFileEntryMetadata.class)</strong></em> with:<br><pre><code>DLFileEntryMetadataLocalServiceUtil.dynamicQuery()</code></pre><br>More info see:<br><ul style="list-style: disc outside;"><li><a href="https://web.liferay.com/community/forums/-/message_boards/message/90747545">https://web.liferay.com/community/forums/-/message_boards/message/90747545</a></li><li><a href="https://web.liferay.com/community/forums/-/message_boards/message/90746976">https://web.liferay.com/community/forums/-/message_boards/message/90746976</a></li></ul></body></html>Jorge Diaz2019-04-11T07:57:59ZRE: How search DLFileEntry/DLFileVersion with specific metadata values?Marco Azzalinihttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1131305262019-04-11T07:06:45Z2019-04-11T07:06:45Z<html><head></head><body><blockquote>Jorge DíazHi Marco,<br><br>DLFileEntry metadata is not stored in same table, so it is not possible to do that dynamic query.<br><br>You can query the search index or you have to query the tables were data is stored.<br><br>More information see following links:<br><ul style="list-style: disc outside;"><li><a href="https://community.liferay.com/forums/-/message_boards/view_message/90731233">https://community.liferay.com/forums/-/message_boards/view_message/90731233</a></li><li><a href="https://community.liferay.com/forums/-/message_boards/view_message/30782428">https://community.liferay.com/forums/-/message_boards/view_message/30782428</a></li><li><a href="https://community.liferay.com/forums/-/message_boards/message/90713583">https://community.liferay.com/forums/-/message_boards/message/90713583</a></li><li><a href="https://community.liferay.com/forums/-/message_boards/message/27159995">https://community.liferay.com/forums/-/message_boards/message/27159995</a></li></ul></blockquote><br><br>Hi Jorge, thank you very much for your suggestions. Unfortunately that field is not indexed so I can't use the the indexer.<br>Another approach I am trying is to query the ddmcontent.xml column where the metadata are stored, this works fine and I am able to get the ddmContent ids but my second query on DLFileEntryMetadata:<br><br><pre><code>DynamicQuery q=DynamicQueryFactoryUtil.forClass(DLFileEntryMetadata.class);
q.add(PropertyFactoryUtil.forName("ddmstorageid").in(ddmContentsIdsArray));
List<dlfileentrymetadata> fileEntryMetadataList= DLFileEntryMetadataLocalServiceUtil.dynamicQuery(q);</dlfileentrymetadata></code></pre><br>fails raising this exception (??)<br><br>org.hibernate.QueryException: could not resolve property: <strong>ddmstorageid</strong> of: com.liferay.portlet.documentlibrary.model.impl.DLFileEntryMetadataImpl<br><br>Do you have any idea why the ddmstorageid property is not found?<br><br>My last chance could be process a large bunch of FileVersions and analyze their FieldMaps but I would really prefer to be able to make Database engine do the work for me ;-)<br><br><br>regards,<br>Marco</body></html>Marco Azzalini2019-04-11T07:06:45ZRE: How search DLFileEntry/DLFileVersion with specific metadata values?Jorge Diazhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1131232912019-04-10T16:04:11Z2019-04-10T16:04:11ZHi Marco,<br /><br />DLFileEntry metadata is not stored in same table, so it is not possible to do that dynamic query.<br /><br />You can query the search index or you have to query the tables were data is stored.<br /><br />More information see following links:<br /><ul style="list-style: disc outside;"><li><a href="https://community.liferay.com/forums/-/message_boards/view_message/90731233">https://community.liferay.com/forums/-/message_boards/view_message/90731233</a></li><li><a href="https://community.liferay.com/forums/-/message_boards/view_message/30782428">https://community.liferay.com/forums/-/message_boards/view_message/30782428</a></li><li><a href="https://community.liferay.com/forums/-/message_boards/message/90713583">https://community.liferay.com/forums/-/message_boards/message/90713583</a></li><li><a href="https://community.liferay.com/forums/-/message_boards/message/27159995">https://community.liferay.com/forums/-/message_boards/message/27159995</a></li></ul>Jorge Diaz2019-04-10T16:04:11ZHow search DLFileEntry/DLFileVersion with specific metadata values?Marco Azzalinihttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1131218392019-04-10T15:18:42Z2019-04-10T15:18:42Z<html><head></head><body>Hi, I have a text field in my custom type that it is not indexed.<br>Is it possible to issue a query (Dynamic query) based o