Hi Marina,
Marina Vatkina wrote:
Hi Greg,
I suggest to file a bug and attach a simple test case ;).
I have just filed a bug report (looks like it went to you). Test case
attached.
If you have a
legacy system, can you use its DDL to create your test
environment?
Actually, the target schema is a modified version of the old schema, so
I can't use DDL from the old system. I already have a process for
migrating the old data. I was just trying to be lazy.
Is your
application a JavaEE app? The actual solution will depend on the mode
in which you use TopLink Essentials DDL generation. But in any case the
idea
would be to take the generated .jdbc file, modify and load it yourself,
then
do not use auto DDL generation.
Does it make sense?
Yes, I've done this in the past. I think I'll just add a few more
lines to my Perl script in this case, though.
Thanks for the help!
Cheers,
Greg
thanks,
-marina
Greg Ederer wrote:
Hi Marina,
This does create a table with the correct structure; however, I lose
control over the name of the table, and the column names. I would like
these names to match those in a legacy system. I just tried it with
@JoinTable(name="user_role"), and I got the correct structure and table
name, but the column names do not match those in my legacy table.
Any other suggestions?
Thanks for the help.
Greg
Marina Vatkina wrote:
Hi Greg,
Does it work if you remove @JoinTable annotation? If you use the DDL
generation
feature, the provider will generate a join table for you automatically.
thanks,
-marina
Greg Ederer wrote:
Hi,
I have a ManyToMany relationship between two classes, annotated like so
at the owning end:
@ManyToMany
@JoinTable(name = "user_role", joinColumns =
{@JoinColumn(name = "username", referencedColumnName =
"username")},
inverseJoinColumns = {@JoinColumn(name = "role_name",
referencedColumnName = "name")})
private List<Role> roles = new ArrayList<Role>();
At the other end:
@ManyToMany(mappedBy="roles")
private List<AppUser> appUsers = new
ArrayList<AppUser>();
This produces the following join table (PostgreSQL):
CREATE TABLE user_role
(
role_name varchar(255) NOT NULL,
username varchar(255) NOT NULL,
CONSTRAINT user_role_pkey PRIMARY KEY (role_name, username),
CONSTRAINT fk_user_role_role_name FOREIGN KEY (role_name)
REFERENCES "role" (name) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_user_role_username FOREIGN KEY (username)
REFERENCES app_user (username) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT user_role_username_key UNIQUE (username)
)
The user_role_username_key is unwanted. How can I prevent it from
being generated?
Thanks!
Greg
--
| E R G O N O S I S
| Greg Ederer
| Lead Developer
| greg@ergonosis.com
| 360.379.1157
| | OpenDocument - OK <http://openoffice.org/>
|
--
| E R G O N O S I S
| Greg Ederer
| Lead Developer
| greg@ergonosis.com
| 360.379.1157
| | OpenDocument - OK <http://openoffice.org/>
|