Database « Key « JPA Q&A





1. Hibernate and no PK    stackoverflow.com

Is it possible to create a table (from a JPA annotated hibernate entity) that does not contain a primary key / Id? (I know this is not a good idea. A table ...

2. Foreign key is also part of the primary key    stackoverflow.com

Is it possible in plain JPA or JPA+Hibernate extensions to use a foreign key that is also part of the composite primary key?

@TableGenerator(name = "trial", table = "third",
    ...

3. Hibernate without primary keys generated by db?    stackoverflow.com

I'm building a data warehouse and want to use InfiniDB as the storage engine. However, it doesn't allow primary keys or foreign key constraints (or any constraints for that ...

4. Hibernate on DB's w/o Primary Keys    coderanch.com

Hey All - This is my first post here, so go easy on me The system I am working on has 2 main databases (we'll call them DB1 and DB2), with tables spread among several schemas. DB2 is accessed via synonyms in DB1, so the application only logs into DB1. To complicate things, tables in DB1 have foreign key mappings into ...

6. Wrong / No FK in DB, joining still possible?    forum.hibernate.org

Hi! I have to work an a legacy data base here. I have two tables which should be linked together with a FK, but there is none. So the data import used the wrong columns to link the two tables together (not the PK column in the child table). table_1 ( t1_id PK int, t2_id varchar(20) --> this should be a ...

7. Legacy DB (Compopsite key)    forum.hibernate.org

8. Hibernate Object Keys different from DB keys ?    forum.hibernate.org

Hello everybody, I am working on an application using jboss 4.0.0 and hibernate 2.1.6 on Windows 2000 and I'm having a strange problem with my object keys that's drivng me nuts. I have entered some values into my database by hand to have something to work with. Worked fine. Then I changed the primary key of one of the objects. Now ...

9. Artifical keys in a distributed database environment    forum.hibernate.org

Hi All, I am building an application which has a copy of the application installed at each of the companies branches, each with their own database. Data is moved to a central server and stored in a single database. At the moment I am using a natural key, with the high order key being the Branch Number. I'd like to switch ...





10. what to do if my database don't have Primary Key    forum.hibernate.org

I was in similar situation some time back, I have a old table (Old since I cant change the table, since it used by many application and I have to debug all of them, if I can anything in that table.) It did not have any primary key, and when I used the middlegen tool to get the mapping files, ...

12. Multiple databases & foreign key    forum.hibernate.org

Sorry but hibernate database configuration is done at session level, and as far as i know you cannot map together objects from different sessions since it will raise a configuration error. The fastest would be configuring a remote link between both datases (dblink in oracle for example) so that you are able to see both tables from the same jdbc connection. ...

13. Foreign key using non-database table    forum.hibernate.org

Hibernate 3, Oracle 9i. I've got a problem creating a one-to-many association between two tables. Essentially the foreign-key column in the child object is not actually a column but is the result of a forumla property mapping. I can't work out how to declare the mapping either way. What I would ideally like is tobe able to declare an association between ...

14. [Create DB Structure with Hibernate] Foreign key names    forum.hibernate.org

Dear collegues ! we use hibernate for creating Database structure. While the creation, for foreign key HIbernate uses names like FK8A84412B977E841 and so on. We suppose , Hibernate uses object hash codes or something like that, because when we add new column to a table the foreign key is also changed. Is It possible to make hibernate to use more friendly ...

15. broken foreign keys in legacy database    forum.hibernate.org

16. Legacy database with "0" foreign key and n+1 selec    forum.hibernate.org

I'm using Hibenate with a legacy database (of which i cannot change the schema). Now i got the typical problem: As the old programs don't know about NULL and there's no referential integrity, they use a 0 (zero) in the foreign key instead. Code: @Entity @IdClass(TeamId.class) public class Team implements Serializable { @Id @Column(name = "PTFANR") ...





17. Database without Foreign Keys    forum.hibernate.org

Hello. Im new to Hibernate and I want to know if working with a database wich doesnt use Foreign Keys between tables, I can define these relations in an hibernate-mapping file. For example I have 2 tables, Departements and Users and Users has a field called Dept but no FK references Departments table. In Hibernate what would happen if I create ...

18. Hibernate and Primary Key in DataBase.    forum.hibernate.org