Details

      Description

      This is generated from service builder columns:

      public class NewsModelImpl extends BaseModelImpl<News> implements NewsModel {
      
      	public static final String TABLE_NAME = "news";
      	public static final Object[][] TABLE_COLUMNS = {
      			{ "newsId", Types.BIGINT },
      			{ "categoryId", Types.BIGINT },
      			{ "companyId", Types.BIGINT },
      			{ "title", Types.VARCHAR },
      			{ "description", Types.VARCHAR },
      			{ "date_from", Types.TIMESTAMP },
      			{ "date_to", Types.TIMESTAMP }
      		};
      

      How can I use column constant for "categoryId" ?
      to be type-safe query it's need to use constant the same like TABLE_NAME. Now if I rename categoryId column I can regenerate service builder and build project without error. SQL error will appear after deploy this to production.. too late.

      public class NewsLocalServiceImpl extends NewsLocalServiceBaseImpl {
      
      	public List<News> findByDateFromDateTo() {
      		Date now = new Date();
      		OrderByComparator<News> orderByComparator = OrderByComparatorFactoryUtil.create(NewsModelImpl.TABLE_NAME, "categoryId", true); //todo categoryId is not Type-Safe
      		return NewsUtil.findByDateFromDateTo(now, now, QueryUtil.ALL_POS, QueryUtil.ALL_POS, orderByComparator, false);
      	}
      }
      

        Attachments

          Activity

            People

            • Assignee:
              support-lep@liferay.com SE Support
              Reporter:
              sytolk Stanimir
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Packages

                Version Package