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].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.


Reply via email to