Announcement Announcement Module
Collapse
No announcement yet.
roo & mysql Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • roo & mysql

    Hi all,

    I'm stucked with my mysql database,

    Code:
    project --topLevelPackage com.test
    
    persistence setup --provider HIBERNATE --database MYSQL
    database properties set --key database.password --value userpass
    database properties set --key database.username --value useruser
    database properties set --key database.url --value jdbc:mysql://localhost:3306/test
    database properties set --key database.driverClassName --value com.mysql.jdbc.Driver
    
    entity --class ~.domain.Question --testAutomatically
    field string --fieldName question --notNull --sizeMin 1 --sizeMax 250
    field string --fieldName complement 
    field date created --type java.util.Date
    field date modified --type java.util.Date
    controller scaffold ~.web.QuestionController
    the table generation is ok but I want 3 little things:
    utf8_general_ci for my table Question
    utf8_general_ci for my string fields question and complement
    timestamp for my date fields instead of datetime

    is it possible? and of course how can i do this?

    thx in advance.

  • #2
    I'm not a MySql expert, but isn't this a setting you nominate when you add a MySql database?

    Comment


    • #3
      Hi Ben,
      you're right, it's made when you create your new database. But in some case you'll need to use case sensitive or case insensitive:
      • utf8_general_cs
      • utf8_general_ci

      actually for test purposes I'll just use utf8_general_ci with
      Code:
      CREATE DATABASE `test` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
      btw I'm still searching how to use timestamp type fields, do you think it's possible to generate them directly with roo?

      Comment


      • #4
        We did have support for timestamps at one point, but removed it from the "field date" command due to issues involving timezones and date formatting in web applications. My suggestion is to use the java.util.Calendar support in "field date". Did you have a particular reason you were looking to use timestamps?

        Comment


        • #5
          Hmmm, it's just a bad habit to record dates and times in timestamp (traces of php, I think)
          If I really want them I think I could always use "field number myfalsetimestamp --type java.lang.Integer"

          thanks for your replies Ben,
          and Happy New Year Roo!

          Comment

          Working...
          X