Announcement Announcement Module
Collapse
No announcement yet.
how to let hhb2dll generate table field with type timestamp? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to let hhb2dll generate table field with type timestamp?

    db manager make date type with timestamp,but my roo generate date?


  • #2
    When creating a date field, you can specify the persistence type using the option --persistenceType JPA_TIMESTAMP.

    Comment


    • #3
      when using the option --persistenceType JPA_TIMESTAMP
      then
      could't format the date?
      i use
      "field date --fieldName testDate --persistenceType JPA_TIMESTAMP --class ~.domain.Person --type java.util.Date --notNull --dateFormat MEDIUM --timeFormat MEDIUM
      "

      roo still generating field datatype

      @NotNull
      @Temporal(TemporalType.TIMESTAMP)
      @DateTimeFormat(style = "MM")
      private Date testDate;
      db schema:
      `test_date` datetime NOT NULL,

      what's matter?

      Comment


      • #4
        What problem are you having? What's the error or exception that you're getting?

        Comment


        • #5
          If the part you've labeled as "db schema:" is what's being output, then I assume the field is called test_date in your DB. The field testDate won't map to that by default since the naming does not match. You would need to add the annotation @Column(name = 'test_date') to the field as well. Or specify --column test_date in your command when creating the field.

          Comment


          • #6
            i means that
            hbm2ddl
            generating DDL is
            CREATE TABLE `user` (
            `id` int(11) NOT NULL AUTO_INCREMENT,
            `addtime` datetime NOT NULL,
            `balance` double DEFAULT NULL,
            `password` varchar(255) COLLATE utf8_bin DEFAULT NULL,
            `test_date` datetime NOT NULL,
            `mobile` varchar(21) COLLATE utf8_bin NOT NULL,
            `version` int(11) DEFAULT NULL,
            PRIMARY KEY (`id`)
            }

            but i want generating
            CREATE TABLE `user` (
            `id` int(11) NOT NULL AUTO_INCREMENT,
            `addtime` datetime NOT NULL,
            `balance` double DEFAULT NULL,
            `password` varchar(255) COLLATE utf8_bin DEFAULT NULL,
            `test_date` Stamp NOT NULL,
            `mobile` varchar(21) COLLATE utf8_bin NOT NULL,
            `version` int(11) DEFAULT NULL,
            PRIMARY KEY (`id`)
            }


            please attention to "red" color words.

            Comment

            Working...
            X