joining of tables

#1

Hi

In objectdb site i found :Note: This ORM/SQL annotation is silently ignored by ObjectDB

so i want  join tow table and generate a third table.

Ex:

 table 1: employee    table 2: address  and the generate table will be table 3: emp_add

employee: e_id, e_name

address: add_id, city, house_no;

the third table will be like.

emp_add: e_id, add_id

i am using annotation like:

in Employee class:

 @ManyToMany
    @JoinTable(name = "emp_add",
            joinColumns
            = @JoinColumn(name = "e_id", referencedColumnName = "e_id"), 
            inverseJoinColumns
            = @JoinColumn(name = "add_id", referencedColumnName = "add_id") 
    )

public Set getAddress()
    {
        return address;
    }

in Address class:

@ManyToMany(mappedBy = "address")
    public Set getEmployee()
    {
        return employee;
    }

how can i solve this problem.....

if you want to see my source code below attach section

Thank you

 

#2

One of the benefits of using ObjectDB is that relationships are managed automatically.

Just define the relationship between Employee and Address as a Java reference field in Employee or if it is bidirectional relationships also add a reference back from Address to Employee with a mappedBy setting.

You can use either a to-one reference (Address) or to-many reference (e.g. List<Address>).

See the manual for more details.

ObjectDB Support

Reply