Help with Spring/Hibernate many to many CRUD interface?

Hi,

can you help me with how I need to design the interface for CRUD ops using the Spring/Hibernate objects below?
I am new to hibernate and I am not seeing how I need to design the interface for CRUD ops.

Do I collect values for both author and citation in one form?
Or Do I collect the citation value first then create another form to collect the author value then attach this author record below the citation  like parent/child view?

Is there an example that uses to spring/hibernate to do insert  manyToMany relation tables?

Author(authorid,lastname,firstname)
Citation(citationid, articletitle,articletype)


public class Author {

@ManyToMany
@JoinTable(name="citation_author",
joinColumns={@JoinColumn(name="authorid")},
inverseJoinColumns={@JoinColumn(name="citationid")})
public List<Citation> getCitations() {return citations;}
}

public class Citation {
@ManyToMany
@JoinTable(name="citation_author",
joinColumns={@JoinColumn(name="citationid")},
inverseJoinColumns={@JoinColumn(name="authorid")})
public List<Author> getAuthors() {return authors;}
}

Open in new window

I forgot about the association table:
author_citation (authorid,citationid)

Open in new window

dkim18Asked:
Who is Participating?
 
sweetfa2Commented:
0
 
sweetfa2Commented:
Spring Hibernate Tutorial

First off, it seems you are getting confused between your presentation layer and your model layer.

You are working on your underlying persisteance layer which is part of your object model.  Therefore how you load your information is irrelevant in terms of the design of your persistence model.

Notwithstanding that, there is no reason you couldn't take either approach at your presentation layer depending on the business use case for extracting these values.
0
 
dkim18Author Commented:
yes, I need help with presentation. Any suggestions?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.