I would try using another template or build your own that is customized to the output you want. I can't remember which template I used, but it wasn't one of the "doodads" templates, you need to download the nHibernate templates for MyGeneration as I don't believe they are included by default.
I should also point out there is quite a bit of documentation (often in the form of blog posts etc.) on using nHibernate with ASP.NET you should check out nhforge.org as one source. You should also consider watching the "Summer of nHibernate" tutorials http://www.summerofnhibernate.com/. These explain almost all of the basic concepts that are useful to know when using nHibernate. One thing you might check out (I haven't used it myself yet) is Visual nHibernate which is a commercial software product that gives you a visual designer. I believe you can drag and drop from the database to create entities from tables. Not sure how good it is though. http://www.slyce.com/ Chris On Fri, Jan 8, 2010 at 9:26 AM, boban984 <[email protected]>wrote: > Thank u guys > > I used MyGenration to genrate dOOdads -> busines entities for all my > tables. > > The thing is i ended up with 70 C# classes (for the 70 tables) , all > the classes have more than 1500 rows . > Where as in JAVA the eclipse plugin for hibernate Generated about 200 > lines of code , that include only the columns of the tabels as private > variables and the getters and setters. > Something like this: > @Entity > @Table(name = "staff", schema = "public") > public class Staff { > > private long staffId; > private Institution institution; > private Person person; > private Date fromDate; > private Date toDate; > private RoleType roleType; > > public Staff() { > } > > public Staff(long staffId, Institution institution, Person person, > Date fromDate, Date toDate) { > this.staffId = staffId; > this.institution = institution; > this.person = person; > this.fromDate = fromDate; > this.toDate = toDate; > } > > @Id > @GeneratedValue(strategy = GenerationType.IDENTITY) > @Column(name = "staff_id", unique = true, nullable = false) > public long getStaffId() { > return this.staffId; > } > > public void setStaffId(long staffId) { > this.staffId = staffId; > } > > @ManyToOne(fetch = FetchType.LAZY) > @JoinColumn(name = "institution_id", nullable = false) > public Institution getInstitution() { > return this.institution; > } > > public void setInstitution(Institution institution) { > this.institution = institution; > } > > @ManyToOne(fetch = FetchType.LAZY) > @JoinColumn(name = "person_id", nullable = false) > public Person getPerson() { > return this.person; > } > > public void setPerson(Person person) { > this.person = person; > } > > @ManyToOne(fetch = FetchType.LAZY) > @JoinColumn(name = "role_type_id", nullable = false) > public RoleType getRoleType() { > return this.roleType; > } > > public void setRoleType(RoleType roleType) { > this.roleType = roleType; > } > > @Column(name = "from_date") > public Date getFromDate() { > return this.fromDate; > } > > public void setFromDate(Date fromDate) { > this.fromDate = fromDate; > } > > @Column(name = "to_date") > public Date getToDate() { > return this.toDate; > } > > public void setToDate(Date toDate) { > this.toDate = toDate; > } > > public String toString() { > return person + " " + institution; > } > } > > Then i would make the DAOs for the entities , and Management classes > using SPRING. > The DAOs would have all the code for manipulating data. > > Now with NHibernate and MyGeneration , i have all the entities again > with all the variables from the tables columns , but also some EXTRA > code :) . > The next step would be to make the mappings. > > I thought the process would be similar with JAVA\Hibernate. > I would appreciate if anyone could give a link to a tutorial or > recommend a good book , describing how to make a simple app using > ASP .net , NHibernate. > All the tutorials i found were not describing code generation and the > DB was not made. > > Im looking for a tutorial that would describe the process of making an > app starting with a Finished DB schema , then generate the Classes for > the tables , generate the mapping , making DAOs if thats the way to do > it in asp.net C#. > > Thank u all again > i know these are noob questions , but the Documentation and tutorials > on using NHibernate with ASP.net are really scarce. > > > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > > >--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
