sexta-feira, 20 de maio de 2016

JPA: Definir nome para chave strangeira

@OneToOne
@JoinColumn(foreignKey = @ForeignKey(name = "FK_CIDADE_PAIS"))
private Pais pais;

quinta-feira, 19 de maio de 2016

Oracle - drop table constraints without dropping tables

Fonte: http://stackoverflow.com/questions/3701233/oracle-drop-table-constraints-without-dropping-tables

begin
    for r in ( select table_name, constraint_name
               from user_constraints
               where constraint_type = 'R' )
    loop
        execute immediate 'alter table '||r.table_name
                          ||' drop constraint '||r.constraint_name;
    end loop;
end loop;