Announcement Announcement Module
Collapse
No announcement yet.
rookie: roo with old postgresql database Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • rookie: roo with old postgresql database

    Hello all, a wonderful life+time-saving roo; bravo!

    1. When using an existing database, I get all of the affected tables re-created everytime. How could I preserve even the existing data?

    2. My existing database is not consistent (many primary keys are not created and id-columns are not unique for the sake of flexibility (such is my domain field..))
    How can I convert my database so that roo's hibernate model accepts it (from postgres command line: adding version columns to all entity tables, adding a unique primary key constraints, what else?..)

    2.1 Ability to edit the primary key (now it uses hibernate sequence which is global for overall entities created) ?

    3. Some of the entities must have a reference field (foreign key) which does not have a unique constraint. Can the foreign key be associated not between identity columns, but other columns?

    Thanks for help;

    --
    sledge

  • #2
    Hello all, a wonderful life+time-saving roo; bravo!
    You're very welcome. I like your choice of database, too. I don't know why more people don't use Postgres. It really is simply fantastic. I have been using some of its nice trigger and free text search capabilities lately on a pet project and it never ceases to impress me.

    1. When using an existing database, I get all of the affected tables re-created everytime. How could I preserve even the existing data?
    Answer here: http://forum.springsource.org/showpo...07&postcount=5

    2. My existing database is not consistent (many primary keys are not created and id-columns are not unique for the sake of flexibility (such is my domain field..)). How can I convert my database so that roo's hibernate model accepts it (from postgres command line: adding version columns to all entity tables, adding a unique primary key constraints, what else?..)
    If you take a look at http://docs.jboss.org/hibernate/core...iguration.html in Table 7.3 you will see the hibernate.hbm2ddl settings available. You probably want to use "update".

    2.1 Ability to edit the primary key (now it uses hibernate sequence which is global for overall entities created) ?
    You can't change a primary key of a table. :-) You might need to use the fact Roo doesn't mind which identifier column is used. This was discussed in this post http://forum.springsource.org/showpo...5&postcount=16 (and elsewhere in the Roo forum, so feel free to search for @RooEntity discussions).

    3. Some of the entities must have a reference field (foreign key) which does not have a unique constraint. Can the foreign key be associated not between identity columns, but other columns?
    Could you please expand on this question? Roo just uses normal JPA and Hibernate, so whatever you can do with them normally is available with Roo. I've not encountered any restrictions with requiring a unique constraint and foreign keys in Roo, so I'm not confident I understand this part of your question.

    Thanks for help;
    You're welcome. Hope you enjoy using Roo.

    Cheers
    Ben

    Comment

    Working...
    X