Hibernate tools: how to ignore foreign keys?

Satmurat

Hibernate tools (for Eclipse) reverse engeneering generates POJO with reference fields. How to ignore DB relation? For example,

class User {
 private City city;
...
}

I want get

class User{
private Integer cityId;
...
}
Satmurat

Finally, I found answer for my question. I created reverse engeneering strategy class and override some methods:


public class RevengStrategy extends DelegatingReverseEngineeringStrategy  {

    public RevengStrategy(ReverseEngineeringStrategy delegate) {
        super(delegate);
    }

    @Override
    public boolean excludeForeignKeyAsManytoOne(String keyname, TableIdentifier fromTable, List fromColumns, TableIdentifier referencedTable, List referencedColumns) {
        return true;
    }

    @Override
    public boolean excludeForeignKeyAsCollection(String keyname, TableIdentifier fromTable, List fromColumns, TableIdentifier referencedTable, List referencedColumns) {
        return true;
    }

}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to execute annotate in Django model with foreign keys?

From Dev

Is it possible to use Hibernate without foreign keys

From Dev

Hibernate with two foreign keys from same table- annotation

From Dev

How to use strong parameters with foreign keys

From Dev

How to ignore a Foreign Key restriction on delete?

From Dev

How to name foreign keys with database first approach

From Dev

how to add foreign keys in EF 7 alpha

From Dev

Hibernate tools: how to ignore foreign keys?

From Dev

How to Mimic Postgres Foreign Keys into a Partitioned Table

From Dev

How to remove duplicate rows with foreign keys dependencies?

From Dev

Hibernate JPA : ignore wrong sql foreign key values

From Dev

How to create two compound foreign keys in ABAP

From Dev

JPA Hibernate two foreign keys to the same table

From Dev

How to save a foreign key in hibernate?

From Dev

Hibernate - Foreign and primary keys in inheritance

From Dev

How to define foreign keys in migrations?

From Dev

How to set foreign keys in Firestore?

From Dev

How to select the items with foreign keys?

From Dev

How to save a foreign key in hibernate?

From Dev

What's the correct format to insert a entity with foreign keys in Hibernate?

From Dev

How to use two foreign keys as primary key on Hibernate entity annotation

From Dev

Hibernate join of two tables with foreign keys

From Dev

JPA Hibernate two foreign keys to the same table

From Dev

Hibernate Mapping composite primary key that contains foreign keys

From Dev

How to define foreign keys in migrations?

From Dev

Is it possible to map foreign keys with hibernate annotations?

From Dev

Foreign keys in ManyToMany Java + Hibernate + MySQL

From Dev

How to save foreign keys (SQL)

From Dev

Retrieve data from a table with two foreign keys using hibernate

Related Related

  1. 1

    How to execute annotate in Django model with foreign keys?

  2. 2

    Is it possible to use Hibernate without foreign keys

  3. 3

    Hibernate with two foreign keys from same table- annotation

  4. 4

    How to use strong parameters with foreign keys

  5. 5

    How to ignore a Foreign Key restriction on delete?

  6. 6

    How to name foreign keys with database first approach

  7. 7

    how to add foreign keys in EF 7 alpha

  8. 8

    Hibernate tools: how to ignore foreign keys?

  9. 9

    How to Mimic Postgres Foreign Keys into a Partitioned Table

  10. 10

    How to remove duplicate rows with foreign keys dependencies?

  11. 11

    Hibernate JPA : ignore wrong sql foreign key values

  12. 12

    How to create two compound foreign keys in ABAP

  13. 13

    JPA Hibernate two foreign keys to the same table

  14. 14

    How to save a foreign key in hibernate?

  15. 15

    Hibernate - Foreign and primary keys in inheritance

  16. 16

    How to define foreign keys in migrations?

  17. 17

    How to set foreign keys in Firestore?

  18. 18

    How to select the items with foreign keys?

  19. 19

    How to save a foreign key in hibernate?

  20. 20

    What's the correct format to insert a entity with foreign keys in Hibernate?

  21. 21

    How to use two foreign keys as primary key on Hibernate entity annotation

  22. 22

    Hibernate join of two tables with foreign keys

  23. 23

    JPA Hibernate two foreign keys to the same table

  24. 24

    Hibernate Mapping composite primary key that contains foreign keys

  25. 25

    How to define foreign keys in migrations?

  26. 26

    Is it possible to map foreign keys with hibernate annotations?

  27. 27

    Foreign keys in ManyToMany Java + Hibernate + MySQL

  28. 28

    How to save foreign keys (SQL)

  29. 29

    Retrieve data from a table with two foreign keys using hibernate

HotTag

Archive