Answer the question
In order to leave comments, you need to log in
Java - how to implement automatic generation of classes from a database?
Please tell me a library or method for automatically generating Java classes from a database, taking into account external and internal keys. Example:
From this SQL code:
CREATE TABLE T1
(
ID INT PRIMARY KEY NOT NULL,
string_value CHAR(100)
);
CREATE TABLE T2
(
ID INT PRIMARY KEY NOT NULL,
string_value CHAR(100),
T1_rec INT NOT NULL
);
ALTER TABLE T2 ADD CONSTRAINT FK_T1_TO_T2
FOREIGN KEY (T1_rec) REFERENCES T1 (ID) ON UPDATE CASCADE ON DELETE CASCADE;
class T1Record
{
public int ID;
public String string_value;
}
class T1Table
{
public Insert(T1Record rec)
public Update(T1Record rec)
...
}
Answer the question
In order to leave comments, you need to log in
Hibernate Reverse Engineering .
Tutorial is here . But you can also google.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question