Hello,
I'm trying to wrap my head around alot of things at the same time here. I've never used Spring framework / MVC before and I have little/no experience with JPA / Hibernate (which I have selected for my experiments so far). I've been reading the tutorials and I find them very informative, but I still have some questions as I try to attach my first real project.
First off. I've been thinking it's a good idea to generalize where I can, for example I was thinking I should create a generic Address class - as addresses are something I will have alot of places in my project. At the same time I'd like the addresses to be stored together with whatever entity they're used with in the database. Also a type many-to-one combo box selection in the UI is not user friendly, the fields of Address should be editable within the form of whatever entity it's used with.
From what I've read (JPA docs) it sounds like I need to use @Embeddable on my Address class and @Embedded wherever I use Address members in my other entities. Is that assumption correct? To illustrate what I mean a little clearer:
and...Code:@Entity @Embeddable @RooJavaBean @RooToString @RooEntity public class Address { @NotNull private String streetAddress; private String streetAddress2; @NotNull private String zip; @NotNull private String city; @NotNull private String country; }
On ROO's part it seems this might be in 1.1.0.M4 based on Jira issue ROO-938 (btw perhaps ROO-1068 is a dupe?)Code:@Entity @RooJavaBean @RooToString @RooEntity public class BusinessCustomer extends CustomerBase { @Embedded @NotNull @OneToOne(targetEntity = Address.class) @JoinColumn private Address visitingAddress; }
and perhaps it's just around the corner. My next question is wether the Spring MVC (or the ROO generated code?) will display such a structure like I want, that is merge the Address fields into the BusinessCustomer fields in the above example.
Off topic I really like the way ROO works and my hope is that I've finally found a RAD way of building applications that will be default choice for me.
An off topic question, can you to recommend a persistence --provider to use. I've heard about Hibernate a lot of times, so I chose that thinking it's mature and stable. OpenJPA sounds like something which might have closer ties to JPA itself, so maybe thats a good bet?Or maybe one of the others?
M


Or maybe one of the others?
Reply With Quote