<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Service Builder 7.1 - Date cannot be resolved to a type</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=112865239" />
  <subtitle>Service Builder 7.1 - Date cannot be resolved to a type</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=112865239</id>
  <updated>2026-04-05T23:49:17Z</updated>
  <dc:date>2026-04-05T23:49:17Z</dc:date>
  <entry>
    <title>RE: Service Builder 7.1 - Date cannot be resolved to a type</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114557725" />
    <author>
      <name>Claudiu Teodorescu</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114557725</id>
    <updated>2019-08-01T07:57:31Z</updated>
    <published>2019-08-01T07:57:31Z</published>
    <summary type="html">Hi Christoph ,&lt;br /&gt;&lt;br /&gt;Thank you for your reply!&lt;br /&gt;&lt;br /&gt;&lt;div class="quote-title"&gt;Christoph Rabel:&lt;/div&gt;&lt;blockquote&gt; Are you really sure you want a composite key with so many columns (marked as primary=true)?  In your original example you have 6 of them. Looks quite suspicious to me. Are you really sure, you need dateAdded to be part of the primary key?&lt;/blockquote&gt; &lt;br /&gt;&lt;br /&gt;As you can see in the above comment I need a composite key with &lt;strong&gt;3&lt;/strong&gt; columns, because in this way I&amp;#39;m sure that I do not have duplicates, this combination should be unique.&lt;br /&gt;&lt;br /&gt;&lt;div class="quote-title"&gt;Christoph Rabel:&lt;/div&gt;&lt;blockquote&gt; Anyway, obviously you need to remove primary=&amp;#34;true&amp;#34; from the time column to get it working. I am not sure, what your intention and usecase is, but maybe you should just use a single column with a long or something as the primary key.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Yes, for the moment I created an id column with type int but I think to change to long since I have already 462 milions of records in the table.&lt;br /&gt;&lt;br /&gt;My question is if this error:   [ERROR] Failed to execute goal com.liferay:com.liferay.portal.tools.service.builder:1.0.292:build (default-cli) on project MyProject-service: &lt;strong&gt;&lt;strong&gt;Primary key time of entity AAAA&lt;/strong&gt;&lt;/strong&gt;&lt;strong&gt;&lt;strong&gt; must be an int, long, or String &lt;/strong&gt;&lt;/strong&gt;-&amp;gt; [Help 1] &lt;br /&gt;&lt;br /&gt;Is something that l did something wrong or Liferay does not allow me anyway to use in the primary key columns which are Date?&lt;br /&gt;&lt;br /&gt;​​​​​​​</summary>
    <dc:creator>Claudiu Teodorescu</dc:creator>
    <dc:date>2019-08-01T07:57:31Z</dc:date>
  </entry>
  <entry>
    <title>RE: Service Builder 7.1 - Date cannot be resolved to a type</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114381828" />
    <author>
      <name>Christoph Rabel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114381828</id>
    <updated>2019-07-22T14:00:13Z</updated>
    <published>2019-07-22T14:00:13Z</published>
    <summary type="html">Are you really sure you want a composite key with so many columns (marked as primary=true)?  In your original example you have 6 of them. Looks quite suspicious to me.  Are you really sure, you need dateAdded to be part of the primary key?&lt;br /&gt;&lt;br /&gt;Anyway, obviously you need to remove primary=&amp;#34;true&amp;#34; from the time column to get it working. I am not sure, what your intention and usecase is, but maybe you should just use a single column with a long or something as the primary key.</summary>
    <dc:creator>Christoph Rabel</dc:creator>
    <dc:date>2019-07-22T14:00:13Z</dc:date>
  </entry>
  <entry>
    <title>RE: Service Builder 7.1 - Date cannot be resolved to a type</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114330435" />
    <author>
      <name>Claudiu Teodorescu</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114330435</id>
    <updated>2019-07-16T10:44:20Z</updated>
    <published>2019-07-16T10:44:20Z</published>
    <summary type="html">Hi, I&amp;#39;m working with Liferay 7.1.3 GA4 and I get the same error and I try to run Liferay build-service using Liferay Developer Studio 3.6.0: &lt;br /&gt;[ERROR] Failed to execute goal com.liferay:com.liferay.portal.tools.service.builder:1.0.292:build (default-cli) on project MyProject-service: &lt;strong&gt;Primary key time of entity AAAA&lt;/strong&gt;&lt;strong&gt; must be an int, long, or String &lt;/strong&gt;-&amp;gt; [Help 1]&lt;br /&gt;[ERROR] &lt;br /&gt;[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.&lt;br /&gt;[ERROR] Re-run Maven using the -X switch to enable full debug logging.&lt;br /&gt;[ERROR] &lt;br /&gt;[ERROR] For more information about the errors and possible solutions, please read the following articles:&lt;br /&gt;[ERROR] [Help 1] &lt;a href="http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException"&gt;http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException&lt;/a&gt;&lt;br /&gt;My service.xml file:&lt;br /&gt;&amp;lt;service-builder  package-path=&amp;#34;aaaa.bbbb.cccc&amp;#34;&amp;gt;&lt;br /&gt;    &amp;lt;namespace&amp;gt;AAAA&amp;lt;/namespace&amp;gt;&lt;br /&gt;    &amp;lt;entity name=&amp;#34;AAAA&amp;#34; local-service=&amp;#34;true&amp;#34; table=&amp;#34;aaaa_bt&amp;#34; remote-service=&amp;#34;true&amp;#34;&amp;gt;&lt;br /&gt;        &amp;lt;column name=&amp;#34;time&amp;#34; type=&amp;#34;Date&amp;#34; primary=&amp;#34;true&amp;#34;&amp;gt;&amp;lt;/column&amp;gt;&lt;br /&gt;        &amp;lt;column name=&amp;#34;a&amp;#34; type=&amp;#34;int&amp;#34; primary=&amp;#34;true&amp;#34;&amp;gt;&amp;lt;/column&amp;gt;&lt;br /&gt;        &amp;lt;column name=&amp;#34;b&amp;#34; type=&amp;#34;int&amp;#34; primary=&amp;#34;true&amp;#34;&amp;gt;&amp;lt;/column&amp;gt;&lt;br /&gt;        &amp;lt;column name=&amp;#34;c&amp;#34; type=&amp;#34;boolean&amp;#34;&amp;gt;&amp;lt;/column&amp;gt;&lt;br /&gt;        &amp;lt;column name=&amp;#34;d&amp;#34; type=&amp;#34;boolean&amp;#34;&amp;gt;&amp;lt;/column&amp;gt;&lt;br /&gt;        &amp;lt;column name=&amp;#34;e&amp;#34; type=&amp;#34;String&amp;#34;&amp;gt;&amp;lt;/column&amp;gt;&lt;br /&gt;        &amp;lt;order&amp;gt;&lt;br /&gt;            &amp;lt;order-column name=&amp;#34;time&amp;#34; order-by=&amp;#34;desc&amp;#34;&amp;gt;&amp;lt;/order-column&amp;gt;&lt;br /&gt;        &amp;lt;/order&amp;gt;&lt;br /&gt;    &amp;lt;/entity&amp;gt;&lt;br /&gt;&amp;lt;/service-builder&amp;gt;&lt;br /&gt;&lt;br /&gt; workspace pom.xml&lt;br /&gt;[url=http://&amp;lt;liferay.workspace.bundle.url&amp;gt;https://releases-cdn.liferay.com/portal/7.1.3-ga4/liferay-ce-portal-tomcat-7.1.3-ga4-20190508171117552.tar.gz&amp;lt;/liferay.workspace.bundle.url&amp;gt;]&amp;lt;properties&amp;gt;&lt;br /&gt;        &amp;lt;project.build.sourceEncoding&amp;gt;UTF-8&amp;lt;/project.build.sourceEncoding&amp;gt;&lt;br /&gt;        &amp;lt;liferay.workspace.bundle.url&amp;gt;https://releases-cdn.liferay.com/portal/7.1.3-ga4/liferay-ce-portal-tomcat-7.1.3-ga4-20190508171117552.tar.gz&amp;lt;/liferay.workspace.bundle.url&amp;gt;&lt;br /&gt;[url=http://[url=http://&amp;lt;liferay.workspace.bundle.url&amp;gt;https://releases-cdn.liferay.com/portal/7.1.3-ga4/liferay-ce-portal-tomcat-7.1.3-ga4-20190508171117552.tar.gz&amp;lt;/liferay.workspace.bundle.url&amp;gt;]&amp;lt;/properties&amp;gt;][url=http://&amp;lt;liferay.workspace.bundle.url&amp;gt;https://releases-cdn.liferay.com/portal/7.1.3-ga4/liferay-ce-portal-tomcat-7.1.3-ga4-20190508171117552.tar.gz&amp;lt;/liferay.workspace.bundle.url&amp;gt;]&amp;lt;/properties&amp;gt;&lt;br /&gt;&lt;br /&gt;service pom.xml:&lt;br /&gt;&amp;lt;plugin&amp;gt;&lt;br /&gt;                &amp;lt;groupId&amp;gt;com.liferay&amp;lt;/groupId&amp;gt;&lt;br /&gt;                &amp;lt;artifactId&amp;gt;com.liferay.portal.tools.service.builder&amp;lt;/artifactId&amp;gt;&lt;br /&gt;                &amp;lt;version&amp;gt;&lt;strong&gt;1.0.292&lt;/strong&gt;&amp;lt;/version&amp;gt;&lt;br /&gt;                &amp;lt;configuration&amp;gt;&lt;br /&gt;                    ....&lt;br /&gt;                &amp;lt;/configuration&amp;gt;&lt;br /&gt; &amp;lt;/plugin&amp;gt;&lt;br /&gt;&lt;br /&gt;I don&amp;#39;t know how to solve this error.Thank you!</summary>
    <dc:creator>Claudiu Teodorescu</dc:creator>
    <dc:date>2019-07-16T10:44:20Z</dc:date>
  </entry>
  <entry>
    <title>RE: Service Builder 7.1 - Date cannot be resolved to a type</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=112866998" />
    <author>
      <name>Christoph Rabel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=112866998</id>
    <updated>2019-03-23T08:35:13Z</updated>
    <published>2019-03-23T08:35:13Z</published>
    <summary type="html">Hmm, I copied your entity now in a 7.1 test project and I get an error when building the service:&lt;br /&gt;&lt;br /&gt;java.lang.IllegalArgumentException: Primary key dateAdded of entity InterventionAgingReportCarePlan must be an int, long, or String service.input.file=${service.file}&lt;br /&gt;&lt;br /&gt;Did you do something special? Some flags?</summary>
    <dc:creator>Christoph Rabel</dc:creator>
    <dc:date>2019-03-23T08:35:13Z</dc:date>
  </entry>
  <entry>
    <title>Service Builder 7.1 - Date cannot be resolved to a type</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=112865238" />
    <author>
      <name>Kevin Neibarger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=112865238</id>
    <updated>2019-03-22T21:13:32Z</updated>
    <published>2019-03-22T21:13:32Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;I'm currently seeing when generating service layer classes with SB in Liferay 7.1. It appears to not add the import java.util.Date for the model implementation generated class. My entity is defined&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;​​​​​​​&amp;lt;entity name="InterventionAgingReportCarePlan" table="InterventionAgingReportCarePlan" local-service="true" data-source="baycarePopulation" remote-service="false" uuid="false"&amp;gt;

&amp;lt;column name="upi" db-name="UPI" type="int" primary="true" /&amp;gt;

&amp;lt;column name="prm" db-name="PRM" type="String" /&amp;gt;

&amp;lt;column name="practice" db-name="Practice" type="String" primary="true" /&amp;gt;

&amp;lt;column name="practiceStatus" db-name="PracticeStatus" type="String" /&amp;gt;

&amp;lt;column name="secondaryStatus" db-name="SecondaryStatus" type="String" /&amp;gt;

&amp;lt;column name="fullName" type="String" /&amp;gt;

&amp;lt;column name="programStatus" db-name="ProgramStatus" type="String" /&amp;gt;

&amp;lt;column name="DOD" type="Date" /&amp;gt;

&amp;lt;column name="Deceased" type="String" /&amp;gt;

&amp;lt;column name="payer" type="String" /&amp;gt;

&amp;lt;column name="category" type="String" primary="true" /&amp;gt;

&amp;lt;column name="subCategory" type="String" primary="true" /&amp;gt;

&amp;lt;column name="detail" type="String" primary="true" /&amp;gt;

&amp;lt;column name="caseOwner" type="String" /&amp;gt;

[b]&amp;lt;column name="dateAdded" type="Date" primary="true" /&amp;gt;[/b]

&amp;lt;column name="assignedTo" type="String" /&amp;gt;


&amp;lt;column name="status" type="String" /&amp;gt;

&amp;lt;column name="met" type="String" /&amp;gt;

&amp;lt;column name="closedReason" type="String" /&amp;gt;

&amp;lt;column name="closedDate" type="Date" /&amp;gt;

&amp;lt;column name="closedBy" type="String" /&amp;gt;


&amp;lt;/entity&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;And when I've built it, I see the generated Model in the *-api classes shows errors "Date cannot be resolved to a type". And, yes, it's because java.util.Date is not in the imports.&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;public static final Accessor&amp;lt;interventionagingreportcareplan, date&amp;gt; DATE_ADDED_ACCESSOR =

new Accessor&amp;lt;interventionagingreportcareplan, date&amp;gt;() {

@Override

public Date get(

InterventionAgingReportCarePlan interventionAgingReportCarePlan) {

return interventionAgingReportCarePlan.getDateAdded();

}


@Override

public Class&amp;lt;date&amp;gt; getAttributeClass() {

return Date.class;

}


@Override

public Class&amp;lt;interventionagingreportcareplan&amp;gt; getTypeClass() {

return InterventionAgingReportCarePlan.class;

}

};&amp;lt;/interventionagingreportcareplan&amp;gt;&amp;lt;/date&amp;gt;&amp;lt;/interventionagingreportcareplan,&amp;gt;&amp;lt;/interventionagingreportcareplan,&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;I had a similar issue with a column that was referenced as a Date but was actually a String, but the column&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;​​​​​​​in this case&amp;nbsp;is in fact a type of&amp;nbsp;&lt;strong&gt;datetime&lt;/strong&gt;&amp;nbsp;in MySQL DB&lt;br&gt;&lt;br&gt;Can anyone tell me why the java.util.Date would not be imported in the generated class? &amp;nbsp;I've used this data type in other entities with no problem...&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Kevin Neibarger</dc:creator>
    <dc:date>2019-03-22T21:13:32Z</dc:date>
  </entry>
</feed>
