├── .gitignore ├── ComponsitePrimaryKey ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── supportmycode │ │ │ ├── dao │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Employee.java │ │ │ └── EmployeeKey.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── com.supportmycode.dao │ └── ComponsitePrimaryKey │ ├── pom.properties │ └── pom.xml ├── ConnectionPool-C3P0 ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── App.java │ │ │ ├── model │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ ├── hibernate.cfg.xml │ │ └── tables.sql └── target │ ├── classes │ ├── hibernate.cfg.xml │ └── tables.sql │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── ConnectionPool-C3P0 │ ├── pom.properties │ └── pom.xml ├── CustomGenerator ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── java │ └── com │ │ └── supportmycode │ │ ├── dao │ │ └── Main.java │ │ ├── model │ │ └── Employee.java │ │ └── persistence │ │ └── HibernateUtil.java ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── supportmycode │ │ │ ├── dao │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Employee.java │ │ │ └── EmployeeIdGenerator.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── com.supportmycode.dao │ └── CustomGenerator │ ├── pom.properties │ └── pom.xml ├── EqualsAndHashcode ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── supportmycode │ │ │ ├── dao │ │ │ └── App.java │ │ │ ├── model │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── com.supportmycode.dao │ └── EqualsAndHashcode │ ├── pom.properties │ └── pom.xml ├── FirstLevelCache ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── supportmycode │ │ │ ├── dao │ │ │ └── App.java │ │ │ ├── model │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── com.supportmycode.dao │ └── FirstLevelCache │ ├── pom.properties │ └── pom.xml ├── HibernateExample-Annotation ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ ├── App.java │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ ├── hibernate.cfg.xml │ │ └── tables.sql └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── HibernateExample-Annotation │ ├── pom.properties │ └── pom.xml ├── HibernateExample-XML ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ ├── App.java │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ ├── hibernate.cfg.xml │ │ ├── in │ │ └── codelearn │ │ │ └── common │ │ │ └── Employee.hbm.xml │ │ └── tables.sql └── target │ ├── classes │ ├── hibernate.cfg.xml │ ├── in │ │ └── codelearn │ │ │ └── common │ │ │ └── Employee.hbm.xml │ └── tables.sql │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── HibernateExample-XML │ ├── pom.properties │ └── pom.xml ├── LazyLoading ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── supportmycode │ │ │ ├── dao │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Department.java │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── com.supportmycode.dao │ └── LazyLoading │ ├── pom.properties │ └── pom.xml ├── ManyToMany-Annotation ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Employee.java │ │ │ └── Meeting.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── ManyToMany-Annotation │ ├── pom.properties │ └── pom.xml ├── ManyToMany-XML ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Employee.java │ │ │ └── Meeting.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ ├── hibernate.cfg.xml │ │ └── in │ │ └── codelearn │ │ └── model │ │ ├── Employee.hbm.xml │ │ └── Meeting.hbm.xml └── target │ ├── classes │ ├── hibernate.cfg.xml │ └── in │ │ └── codelearn │ │ └── model │ │ ├── Employee.hbm.xml │ │ └── Meeting.hbm.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── ManyToMany-XML │ ├── pom.properties │ └── pom.xml ├── OneTablePerConcreteClass-Annotation ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Employee.java │ │ │ ├── Owner.java │ │ │ └── Person.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── OneTablePerConcreteClass-Annotation │ ├── pom.properties │ └── pom.xml ├── OneTablePerConcreteClass-XML ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Employee.java │ │ │ ├── Owner.java │ │ │ └── Person.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ ├── hibernate.cfg.xml │ │ └── in │ │ └── codelearn │ │ └── model │ │ └── Person.hbm.xml └── target │ ├── classes │ ├── hibernate.cfg.xml │ └── in │ │ └── codelearn │ │ └── model │ │ └── Person.hbm.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── OneTablePerConcreteClass-XML │ ├── pom.properties │ └── pom.xml ├── OneTablePerHeirarchy-Annotation ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Employee.java │ │ │ └── Person.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── OneTablePerHeirarchy-Annotation │ ├── pom.properties │ └── pom.xml ├── OneTablePerHeirarchy-XML ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Employee.java │ │ │ └── Person.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ ├── hibernate.cfg.xml │ │ └── in │ │ └── codelearn │ │ └── model │ │ └── Person.hbm.xml └── target │ ├── classes │ ├── hibernate.cfg.xml │ └── in │ │ └── codelearn │ │ └── model │ │ └── Person.hbm.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── OneTablePerHeirarchy-XML │ ├── pom.properties │ └── pom.xml ├── OneTablePerSubclass-Annotation ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Employee.java │ │ │ ├── Owner.java │ │ │ └── Person.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── OneTablePerSubclass-Annotation │ ├── pom.properties │ └── pom.xml ├── OneTablePerSubclass-XML ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Employee.java │ │ │ ├── Owner.java │ │ │ └── Person.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ ├── hibernate.cfg.xml │ │ └── in │ │ └── codelearn │ │ └── model │ │ └── Person.hbm.xml └── target │ ├── classes │ ├── hibernate.cfg.xml │ └── in │ │ └── codelearn │ │ └── model │ │ └── Person.hbm.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── OneTablePerSubclass-XML │ ├── pom.properties │ └── pom.xml ├── OneToMany-Annotation ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Department.java │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── OneToMany-Annotation │ ├── pom.properties │ └── pom.xml ├── OneToMany-XML ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Department.java │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ ├── hibernate.cfg.xml │ │ └── in │ │ └── codelearn │ │ └── persistence │ │ ├── Department.hbm.xml │ │ └── Employee.hbm.xml └── target │ ├── classes │ ├── hibernate.cfg.xml │ └── in │ │ └── codelearn │ │ └── persistence │ │ ├── Department.hbm.xml │ │ └── Employee.hbm.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── OneToMany-XML │ ├── pom.properties │ └── pom.xml ├── OneToOne-Annotation ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Employee.java │ │ │ └── EmployeeDetail.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── OneToOne-Annotation │ ├── pom.properties │ └── pom.xml ├── OneToOne-XML ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ ├── Employee.java │ │ │ └── EmployeeDetail.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ ├── hibernate.cfg.xml │ │ └── in │ │ └── codelearn │ │ └── model │ │ ├── Employee.hbm.xml │ │ └── EmployeeDetail.hbm.xml └── target │ ├── classes │ ├── hibernate.cfg.xml │ └── in │ │ └── codelearn │ │ └── model │ │ ├── Employee.hbm.xml │ │ └── EmployeeDetail.hbm.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── OneToOne-XML │ ├── pom.properties │ └── pom.xml ├── PrintQueryString ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── supportmycode │ │ │ ├── dao │ │ │ └── App.java │ │ │ ├── model │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ ├── hibernate.cfg.xml │ │ ├── log4j.properties │ │ └── tables.sql └── target │ ├── classes │ ├── hibernate.cfg.xml │ ├── log4j.properties │ └── tables.sql │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── com.supportmycode.dao │ └── PrintQueryString │ ├── pom.properties │ └── pom.xml ├── README.md ├── ReattachDetachedObject ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── supportmycode │ │ │ ├── dao │ │ │ └── App.java │ │ │ ├── model │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── com.supportmycode.dao │ └── ReattachDetachedObject │ ├── pom.properties │ └── pom.xml ├── SecondLevelCache ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── supportmycode │ │ │ ├── dao │ │ │ └── App.java │ │ │ ├── model │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── com.supportmycode.dao │ └── SecondLevelCache │ ├── pom.properties │ └── pom.xml ├── SelfReference-ManyToMany-Annotation ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── SelfReference-ManyToMany-Annotation │ ├── pom.properties │ └── pom.xml ├── SelfReference-OneToMany-Annotation ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── in │ │ │ └── codelearn │ │ │ ├── common │ │ │ └── Main.java │ │ │ ├── model │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── in.codelearn.common │ └── SelfReference-OneToMany-Annotation │ ├── pom.properties │ └── pom.xml ├── TableGenerator ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── supportmycode │ │ │ ├── dao │ │ │ └── Main.java │ │ │ ├── model │ │ │ └── Employee.java │ │ │ └── persistence │ │ │ └── HibernateUtil.java │ │ └── resources │ │ └── hibernate.cfg.xml └── target │ ├── classes │ └── hibernate.cfg.xml │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── com.supportmycode.dao │ └── TableGenerator │ ├── pom.properties │ └── pom.xml └── hbm2ddl.auto ├── .classpath ├── .project ├── .settings ├── .jsdtscope ├── org.eclipse.jdt.core.prefs ├── org.eclipse.m2e.core.prefs ├── org.eclipse.wst.common.component ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.wst.jsdt.ui.superType.container ├── org.eclipse.wst.jsdt.ui.superType.name ├── org.eclipse.wst.validation.prefs └── org.hibernate.eclipse.console.prefs ├── pom.xml ├── src └── main │ ├── java │ └── com │ │ └── supportmycode │ │ ├── dao │ │ └── App.java │ │ ├── model │ │ └── Employee.java │ │ └── persistence │ │ └── HibernateUtil.java │ └── resources │ ├── hibernate.cfg.xml │ └── tables.sql └── target ├── classes ├── hibernate.cfg.xml └── tables.sql └── m2e-wtp └── web-resources └── META-INF ├── MANIFEST.MF └── maven └── com.supportmycode.dao └── hbm2ddl.auto ├── pom.properties └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | -------------------------------------------------------------------------------- /ComponsitePrimaryKey/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ComponsitePrimaryKey/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /ComponsitePrimaryKey/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /ComponsitePrimaryKey/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ComponsitePrimaryKey/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ComponsitePrimaryKey/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /ComponsitePrimaryKey/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /ComponsitePrimaryKey/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /ComponsitePrimaryKey/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /ComponsitePrimaryKey/src/main/java/com/supportmycode/dao/Main.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.dao; 2 | 3 | import org.hibernate.Session; 4 | import org.hibernate.SessionFactory; 5 | 6 | import com.supportmycode.model.Employee; 7 | import com.supportmycode.model.EmployeeKey; 8 | import com.supportmycode.persistence.HibernateUtil; 9 | 10 | public class Main { 11 | 12 | @SuppressWarnings("unchecked") 13 | public static void main(String[] args) { 14 | 15 | SessionFactory sf = HibernateUtil.getSessionFactory(); 16 | Session session = sf.openSession(); 17 | session.beginTransaction(); 18 | 19 | EmployeeKey empKey = new EmployeeKey(1, "AmEx"); 20 | Employee emp1 = new Employee(empKey, "Nina", "Mayers", "111"); 21 | 22 | session.save(emp1); 23 | session.getTransaction().commit(); 24 | session.close(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ComponsitePrimaryKey/src/main/java/com/supportmycode/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /ComponsitePrimaryKey/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /ComponsitePrimaryKey/target/m2e-wtp/web-resources/META-INF/maven/com.supportmycode.dao/ComponsitePrimaryKey/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sat Aug 23 19:34:22 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.supportmycode.dao 5 | m2e.projectName=ComponsitePrimaryKey 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\ComponsitePrimaryKey 7 | artifactId=ComponsitePrimaryKey 8 | -------------------------------------------------------------------------------- /ConnectionPool-C3P0/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ConnectionPool-C3P0/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /ConnectionPool-C3P0/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /ConnectionPool-C3P0/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ConnectionPool-C3P0/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ConnectionPool-C3P0/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /ConnectionPool-C3P0/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /ConnectionPool-C3P0/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /ConnectionPool-C3P0/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /ConnectionPool-C3P0/src/main/java/in/codelearn/common/App.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.common; 2 | 3 | import in.codelearn.model.Employee; 4 | import in.codelearn.persistence.HibernateUtil; 5 | 6 | import java.sql.Date; 7 | 8 | import org.hibernate.Session; 9 | 10 | 11 | public class App 12 | { 13 | public static void main( String[] args ) 14 | { 15 | System.out.println("Hibernate Example Annotations"); 16 | Session session = HibernateUtil.getSessionFactory().openSession(); 17 | 18 | session.beginTransaction(); 19 | Employee emp = new Employee("James", "Bond", new Date(System.currentTimeMillis()), "007"); 20 | 21 | session.save(emp); 22 | session.getTransaction().commit(); 23 | session.close(); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ConnectionPool-C3P0/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /ConnectionPool-C3P0/src/main/resources/tables.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `employee` ( 2 | `id` BIGINT(10) NOT NULL AUTO_INCREMENT, 3 | `firstname` VARCHAR(50) NULL DEFAULT NULL, 4 | `lastname` VARCHAR(50) NULL DEFAULT NULL, 5 | `birth_date` DATE NOT NULL, 6 | `cell_phone` VARCHAR(15) NOT NULL, 7 | PRIMARY KEY (`id`) 8 | ); -------------------------------------------------------------------------------- /ConnectionPool-C3P0/target/classes/tables.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `employee` ( 2 | `id` BIGINT(10) NOT NULL AUTO_INCREMENT, 3 | `firstname` VARCHAR(50) NULL DEFAULT NULL, 4 | `lastname` VARCHAR(50) NULL DEFAULT NULL, 5 | `birth_date` DATE NOT NULL, 6 | `cell_phone` VARCHAR(15) NOT NULL, 7 | PRIMARY KEY (`id`) 8 | ); -------------------------------------------------------------------------------- /ConnectionPool-C3P0/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /ConnectionPool-C3P0/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/ConnectionPool-C3P0/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sat Aug 16 17:04:00 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=ConnectionPool-C3P0 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\ConnectionPool-C3P0 7 | artifactId=ConnectionPool-C3P0 8 | -------------------------------------------------------------------------------- /CustomGenerator/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /CustomGenerator/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /CustomGenerator/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /CustomGenerator/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /CustomGenerator/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CustomGenerator/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /CustomGenerator/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /CustomGenerator/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /CustomGenerator/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /CustomGenerator/java/com/supportmycode/dao/Main.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.dao; 2 | 3 | import org.hibernate.Session; 4 | import org.hibernate.SessionFactory; 5 | 6 | import com.supportmycode.model.Employee; 7 | import com.supportmycode.persistence.HibernateUtil; 8 | 9 | public class Main { 10 | 11 | @SuppressWarnings("unchecked") 12 | public static void main(String[] args) { 13 | 14 | SessionFactory sf = HibernateUtil.getSessionFactory(); 15 | Session session = sf.openSession(); 16 | session.beginTransaction(); 17 | 18 | Employee emp1 = new Employee("Nina", "Mayers", "111"); 19 | 20 | session.save(emp1); 21 | session.getTransaction().commit(); 22 | session.close(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CustomGenerator/java/com/supportmycode/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /CustomGenerator/src/main/java/com/supportmycode/dao/Main.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.dao; 2 | 3 | import org.hibernate.Session; 4 | import org.hibernate.SessionFactory; 5 | 6 | import com.supportmycode.model.Employee; 7 | import com.supportmycode.persistence.HibernateUtil; 8 | 9 | public class Main { 10 | 11 | @SuppressWarnings("unchecked") 12 | public static void main(String[] args) { 13 | 14 | SessionFactory sf = HibernateUtil.getSessionFactory(); 15 | Session session = sf.openSession(); 16 | session.beginTransaction(); 17 | 18 | Employee emp1 = new Employee("Nina", "Mayers", "111"); 19 | 20 | session.save(emp1); 21 | session.getTransaction().commit(); 22 | session.close(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CustomGenerator/src/main/java/com/supportmycode/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /CustomGenerator/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /CustomGenerator/target/m2e-wtp/web-resources/META-INF/maven/com.supportmycode.dao/CustomGenerator/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Fri Aug 22 07:37:47 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.supportmycode.dao 5 | m2e.projectName=CustomGenerator 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\CustomGenerator 7 | artifactId=CustomGenerator 8 | -------------------------------------------------------------------------------- /EqualsAndHashcode/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /EqualsAndHashcode/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /EqualsAndHashcode/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /EqualsAndHashcode/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /EqualsAndHashcode/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /EqualsAndHashcode/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /EqualsAndHashcode/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /EqualsAndHashcode/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /EqualsAndHashcode/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /EqualsAndHashcode/src/main/java/com/supportmycode/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /EqualsAndHashcode/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /EqualsAndHashcode/target/m2e-wtp/web-resources/META-INF/maven/com.supportmycode.dao/EqualsAndHashcode/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Mon Aug 25 20:43:13 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.supportmycode.dao 5 | m2e.projectName=EqualsAndHashcode 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\EqualsAndHashcode 7 | artifactId=EqualsAndHashcode 8 | -------------------------------------------------------------------------------- /FirstLevelCache/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /FirstLevelCache/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /FirstLevelCache/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /FirstLevelCache/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /FirstLevelCache/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FirstLevelCache/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /FirstLevelCache/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /FirstLevelCache/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /FirstLevelCache/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /FirstLevelCache/src/main/java/com/supportmycode/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /FirstLevelCache/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /FirstLevelCache/target/m2e-wtp/web-resources/META-INF/maven/com.supportmycode.dao/FirstLevelCache/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Tue Aug 26 08:23:50 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.supportmycode.dao 5 | m2e.projectName=FirstLevelCache 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\FirstLevelCache 7 | artifactId=FirstLevelCache 8 | -------------------------------------------------------------------------------- /HibernateExample-Annotation/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /HibernateExample-Annotation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /HibernateExample-Annotation/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /HibernateExample-Annotation/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /HibernateExample-Annotation/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HibernateExample-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /HibernateExample-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /HibernateExample-Annotation/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /HibernateExample-Annotation/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /HibernateExample-Annotation/src/main/java/in/codelearn/common/App.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.common; 2 | 3 | import in.codelearn.persistence.HibernateUtil; 4 | 5 | import java.sql.Date; 6 | import org.hibernate.Session; 7 | 8 | 9 | public class App 10 | { 11 | public static void main( String[] args ) 12 | { 13 | System.out.println("Hibernate Example Annotations"); 14 | Session session = HibernateUtil.getSessionFactory().openSession(); 15 | 16 | session.beginTransaction(); 17 | Employee emp = new Employee("James", "Bond", new Date(System.currentTimeMillis()), "007"); 18 | 19 | session.save(emp); 20 | session.getTransaction().commit(); 21 | session.close(); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /HibernateExample-Annotation/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /HibernateExample-Annotation/src/main/resources/tables.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `employee` ( 2 | `id` BIGINT(10) NOT NULL AUTO_INCREMENT, 3 | `firstname` VARCHAR(50) NULL DEFAULT NULL, 4 | `lastname` VARCHAR(50) NULL DEFAULT NULL, 5 | `birth_date` DATE NOT NULL, 6 | `cell_phone` VARCHAR(15) NOT NULL, 7 | PRIMARY KEY (`id`) 8 | ); -------------------------------------------------------------------------------- /HibernateExample-Annotation/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /HibernateExample-Annotation/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/HibernateExample-Annotation/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 07:54:51 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=HibernateExample-Annotation 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\HibernateExample-Annotation 7 | artifactId=HibernateExample-Annotation 8 | -------------------------------------------------------------------------------- /HibernateExample-XML/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /HibernateExample-XML/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /HibernateExample-XML/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /HibernateExample-XML/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /HibernateExample-XML/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HibernateExample-XML/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /HibernateExample-XML/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /HibernateExample-XML/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /HibernateExample-XML/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /HibernateExample-XML/src/main/java/in/codelearn/common/App.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.common; 2 | 3 | import in.codelearn.persistence.HibernateUtil; 4 | 5 | import org.hibernate.Session; 6 | 7 | public class App 8 | { 9 | public static void main( String[] args ) 10 | { 11 | System.out.println("Hibernate Example XML"); 12 | Session session = HibernateUtil.getSessionFactory().openSession(); 13 | 14 | session.beginTransaction(); 15 | Employee emp = new Employee(); 16 | 17 | emp.setEmployeeCode("123"); 18 | emp.setEmployeeName("James Bond"); 19 | 20 | session.save(emp); 21 | session.getTransaction().commit(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /HibernateExample-XML/src/main/resources/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | false 8 | com.mysql.jdbc.Driver 9 | jdbc:mysql://localhost:3306/hibernate_example_xml 10 | root 11 | root 12 | org.hibernate.dialect.MySQLDialect 13 | true 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /HibernateExample-XML/src/main/resources/in/codelearn/common/Employee.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /HibernateExample-XML/src/main/resources/tables.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `employee`; 2 | CREATE TABLE `employee` ( 3 | `EMPLOYEE_ID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 4 | `EMPLOYEE_CODE` VARCHAR(10) NOT NULL, 5 | `EMPLOYEE_NAME` VARCHAR(20) NOT NULL, 6 | PRIMARY KEY (`EMPLOYEE_ID`) USING BTREE, 7 | UNIQUE KEY `EMPLOYEE_NAME` (`EMPLOYEE_NAME`), 8 | UNIQUE KEY `EMPLOYEE_ID` (`EMPLOYEE_CODE`) USING BTREE 9 | ) -------------------------------------------------------------------------------- /HibernateExample-XML/target/classes/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | false 8 | com.mysql.jdbc.Driver 9 | jdbc:mysql://localhost:3306/hibernate_example_xml 10 | root 11 | root 12 | org.hibernate.dialect.MySQLDialect 13 | true 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /HibernateExample-XML/target/classes/in/codelearn/common/Employee.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /HibernateExample-XML/target/classes/tables.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `employee`; 2 | CREATE TABLE `employee` ( 3 | `EMPLOYEE_ID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 4 | `EMPLOYEE_CODE` VARCHAR(10) NOT NULL, 5 | `EMPLOYEE_NAME` VARCHAR(20) NOT NULL, 6 | PRIMARY KEY (`EMPLOYEE_ID`) USING BTREE, 7 | UNIQUE KEY `EMPLOYEE_NAME` (`EMPLOYEE_NAME`), 8 | UNIQUE KEY `EMPLOYEE_ID` (`EMPLOYEE_CODE`) USING BTREE 9 | ) -------------------------------------------------------------------------------- /HibernateExample-XML/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /HibernateExample-XML/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/HibernateExample-XML/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Wed Aug 13 08:00:11 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=HibernateExample-XML 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\HibernateExample-XML 7 | artifactId=HibernateExample-XML 8 | -------------------------------------------------------------------------------- /LazyLoading/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /LazyLoading/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /LazyLoading/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /LazyLoading/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /LazyLoading/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LazyLoading/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /LazyLoading/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /LazyLoading/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /LazyLoading/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /LazyLoading/src/main/java/com/supportmycode/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /LazyLoading/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /LazyLoading/target/m2e-wtp/web-resources/META-INF/maven/com.supportmycode.dao/LazyLoading/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Wed Aug 20 23:17:58 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.supportmycode.dao 5 | m2e.projectName=LazyLoading 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\LazyLoading 7 | artifactId=LazyLoading 8 | -------------------------------------------------------------------------------- /ManyToMany-Annotation/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ManyToMany-Annotation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /ManyToMany-Annotation/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /ManyToMany-Annotation/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ManyToMany-Annotation/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ManyToMany-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /ManyToMany-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /ManyToMany-Annotation/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /ManyToMany-Annotation/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /ManyToMany-Annotation/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /ManyToMany-Annotation/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /ManyToMany-Annotation/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/ManyToMany-Annotation/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 22:28:08 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=ManyToMany-Annotation 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\ManyToMany-Annotation 7 | artifactId=ManyToMany-Annotation 8 | -------------------------------------------------------------------------------- /ManyToMany-XML/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ManyToMany-XML/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /ManyToMany-XML/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /ManyToMany-XML/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ManyToMany-XML/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ManyToMany-XML/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /ManyToMany-XML/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /ManyToMany-XML/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /ManyToMany-XML/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /ManyToMany-XML/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | in.codelearn.common 4 | ManyToMany-XML 5 | 0.0.1-SNAPSHOT 6 | war 7 | ManyToMany-XML 8 | Many to Many mapping using XML 9 | 10 | 11 | mysql 12 | mysql-connector-java 13 | 5.1.10 14 | 15 | 16 | org.hibernate 17 | hibernate 18 | 3.2.6.ga 19 | 20 | 21 | -------------------------------------------------------------------------------- /ManyToMany-XML/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.Configuration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new Configuration().configure().buildSessionFactory(); 14 | } catch (Throwable ex) { 15 | System.err.println("Initial SessionFactory creation failed." + ex); 16 | throw new ExceptionInInitializerError(ex); 17 | } 18 | } 19 | 20 | public static SessionFactory getSessionFactory() { 21 | return sessionFactory; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ManyToMany-XML/src/main/resources/in/codelearn/model/Employee.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ManyToMany-XML/src/main/resources/in/codelearn/model/Meeting.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /ManyToMany-XML/target/classes/in/codelearn/model/Employee.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ManyToMany-XML/target/classes/in/codelearn/model/Meeting.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /ManyToMany-XML/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /ManyToMany-XML/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/ManyToMany-XML/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 22:19:49 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=ManyToMany-XML 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\ManyToMany-XML 7 | artifactId=ManyToMany-XML 8 | -------------------------------------------------------------------------------- /ManyToMany-XML/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/ManyToMany-XML/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | in.codelearn.common 4 | ManyToMany-XML 5 | 0.0.1-SNAPSHOT 6 | war 7 | ManyToMany-XML 8 | Many to Many mapping using XML 9 | 10 | 11 | mysql 12 | mysql-connector-java 13 | 5.1.10 14 | 15 | 16 | org.hibernate 17 | hibernate 18 | 3.2.6.ga 19 | 20 | 21 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-Annotation/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-Annotation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-Annotation/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-Annotation/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-Annotation/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /OneTablePerConcreteClass-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /OneTablePerConcreteClass-Annotation/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-Annotation/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-Annotation/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-Annotation/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-Annotation/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneTablePerConcreteClass-Annotation/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Fri Aug 15 00:00:15 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=OneTablePerConcreteClass-Annotation 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\OneTablePerConcreteClass-Annotation 7 | artifactId=OneTablePerConcreteClass-Annotation 8 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | in.codelearn.common 4 | OneTablePerConcreteClass-XML 5 | 0.0.1-SNAPSHOT 6 | war 7 | OneTablePerConcreteClass-XML 8 | One Table Per Concrete Class using XML 9 | 10 | 11 | mysql 12 | mysql-connector-java 13 | 5.1.10 14 | 15 | 16 | org.hibernate 17 | hibernate 18 | 3.2.6.ga 19 | 20 | 21 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/src/main/java/in/codelearn/common/Main.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.common; 2 | 3 | import in.codelearn.model.Employee; 4 | import in.codelearn.model.Owner; 5 | import in.codelearn.model.Person; 6 | import in.codelearn.persistence.HibernateUtil; 7 | 8 | import java.util.Date; 9 | 10 | import org.hibernate.Session; 11 | import org.hibernate.SessionFactory; 12 | 13 | public class Main { 14 | 15 | public static void main(String[] args) { 16 | 17 | SessionFactory sf = HibernateUtil.getSessionFactory(); 18 | Session session = sf.openSession(); 19 | session.beginTransaction(); 20 | 21 | 22 | Person person = new Person("Steve", "Balmer"); 23 | session.save(person); 24 | 25 | Employee employee = new Employee("James", "Gosling", "Marketing", new Date()); 26 | session.save(employee); 27 | 28 | Owner owner = new Owner("Bill", "Gates", 300L, 20L); 29 | session.save(owner); 30 | 31 | 32 | session.getTransaction().commit(); 33 | session.close(); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/src/main/java/in/codelearn/model/Employee.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.model; 2 | 3 | import java.util.Date; 4 | 5 | public class Employee extends Person { 6 | 7 | private Date joiningDate; 8 | 9 | private String departmentName; 10 | 11 | public Employee() { 12 | } 13 | 14 | public Employee(String firstname, String lastname, String departmentName, Date joiningDate) { 15 | 16 | super(firstname, lastname); 17 | 18 | this.departmentName = departmentName; 19 | this.joiningDate = joiningDate; 20 | } 21 | 22 | public Date getJoiningDate() { 23 | return joiningDate; 24 | } 25 | public void setJoiningDate(Date joiningDate) { 26 | this.joiningDate = joiningDate; 27 | } 28 | public String getDepartmentName() { 29 | return departmentName; 30 | } 31 | public void setDepartmentName(String departmentName) { 32 | this.departmentName = departmentName; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/src/main/java/in/codelearn/model/Owner.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.model; 2 | 3 | 4 | public class Owner extends Person { 5 | 6 | private Long stocks; 7 | 8 | private Long partnershipStake; 9 | 10 | public Owner() { 11 | } 12 | 13 | public Owner(String firstname, String lastname, Long stocks, Long partnershipStake) { 14 | 15 | super(firstname, lastname); 16 | 17 | this.stocks = stocks; 18 | this.partnershipStake = partnershipStake; 19 | } 20 | 21 | public Long getStocks() { 22 | return stocks; 23 | } 24 | 25 | public void setStocks(Long stocks) { 26 | this.stocks = stocks; 27 | } 28 | 29 | public Long getPartnershipStake() { 30 | return partnershipStake; 31 | } 32 | 33 | public void setPartnershipStake(Long partnershipStake) { 34 | this.partnershipStake = partnershipStake; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/src/main/java/in/codelearn/model/Person.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.model; 2 | 3 | 4 | 5 | public class Person { 6 | 7 | private Long personId; 8 | 9 | private String firstname; 10 | 11 | private String lastname; 12 | 13 | public Person() { 14 | 15 | } 16 | public Person(String firstname, String lastname) { 17 | this.firstname = firstname; 18 | this.lastname = lastname; 19 | } 20 | 21 | public Long getPersonId() { 22 | return personId; 23 | } 24 | public void setPersonId(Long personId) { 25 | this.personId = personId; 26 | } 27 | public String getFirstname() { 28 | return firstname; 29 | } 30 | public void setFirstname(String firstname) { 31 | this.firstname = firstname; 32 | } 33 | public String getLastname() { 34 | return lastname; 35 | } 36 | public void setLastname(String lastname) { 37 | this.lastname = lastname; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.Configuration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new Configuration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneTablePerConcreteClass-XML/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 23:53:03 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=OneTablePerConcreteClass-XML 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\OneTablePerConcreteClass-XML 7 | artifactId=OneTablePerConcreteClass-XML 8 | -------------------------------------------------------------------------------- /OneTablePerConcreteClass-XML/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneTablePerConcreteClass-XML/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | in.codelearn.common 4 | OneTablePerConcreteClass-XML 5 | 0.0.1-SNAPSHOT 6 | war 7 | OneTablePerConcreteClass-XML 8 | One Table Per Concrete Class using XML 9 | 10 | 11 | mysql 12 | mysql-connector-java 13 | 5.1.10 14 | 15 | 16 | org.hibernate 17 | hibernate 18 | 3.2.6.ga 19 | 20 | 21 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-Annotation/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-Annotation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-Annotation/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-Annotation/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-Annotation/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /OneTablePerHeirarchy-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /OneTablePerHeirarchy-Annotation/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-Annotation/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-Annotation/src/main/java/in/codelearn/common/Main.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.common; 2 | 3 | import in.codelearn.model.Employee; 4 | import in.codelearn.model.Person; 5 | import in.codelearn.persistence.HibernateUtil; 6 | 7 | import java.util.Date; 8 | 9 | import org.hibernate.Session; 10 | import org.hibernate.SessionFactory; 11 | 12 | public class Main { 13 | 14 | public static void main(String[] args) { 15 | 16 | SessionFactory sf = HibernateUtil.getSessionFactory(); 17 | Session session = sf.openSession(); 18 | session.beginTransaction(); 19 | 20 | 21 | Person person = new Person("Steve", "Balmer"); 22 | session.save(person); 23 | 24 | Employee employee = new Employee("James", "Gosling", "Marketing", new Date()); 25 | session.save(employee); 26 | 27 | session.getTransaction().commit(); 28 | session.close(); 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-Annotation/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-Annotation/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-Annotation/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneTablePerHeirarchy-Annotation/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 23:21:12 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=OneTablePerHeirarchy-Annotation 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\OneTablePerHeirarchy-Annotation 7 | artifactId=OneTablePerHeirarchy-Annotation 8 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | in.codelearn.common 4 | OneTablePerHeirarchy-XML 5 | 0.0.1-SNAPSHOT 6 | war 7 | OneTablePerHeirarchy-XML 8 | One Table Per Heirarchy-XML 9 | 10 | 11 | mysql 12 | mysql-connector-java 13 | 5.1.10 14 | 15 | 16 | org.hibernate 17 | hibernate 18 | 3.2.6.ga 19 | 20 | 21 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/src/main/java/in/codelearn/common/Main.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.common; 2 | 3 | import in.codelearn.model.Employee; 4 | import in.codelearn.model.Person; 5 | import in.codelearn.persistence.HibernateUtil; 6 | 7 | import java.util.Date; 8 | 9 | import org.hibernate.Session; 10 | import org.hibernate.SessionFactory; 11 | 12 | public class Main { 13 | 14 | public static void main(String[] args) { 15 | 16 | SessionFactory sf = HibernateUtil.getSessionFactory(); 17 | Session session = sf.openSession(); 18 | session.beginTransaction(); 19 | 20 | 21 | Person person = new Person("Steve", "Balmer"); 22 | session.save(person); 23 | 24 | Employee employee = new Employee("James", "Gosling", "Marketing", new Date()); 25 | session.save(employee); 26 | 27 | session.getTransaction().commit(); 28 | session.close(); 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/src/main/java/in/codelearn/model/Employee.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.model; 2 | 3 | import java.util.Date; 4 | 5 | public class Employee extends Person { 6 | 7 | private Date joiningDate; 8 | private String departmentName; 9 | 10 | public Employee() { 11 | } 12 | 13 | public Employee(String firstname, String lastname, String departmentName, Date joiningDate) { 14 | 15 | super(firstname, lastname); 16 | 17 | this.departmentName = departmentName; 18 | this.joiningDate = joiningDate; 19 | } 20 | 21 | public Date getJoiningDate() { 22 | return joiningDate; 23 | } 24 | public void setJoiningDate(Date joiningDate) { 25 | this.joiningDate = joiningDate; 26 | } 27 | public String getDepartmentName() { 28 | return departmentName; 29 | } 30 | public void setDepartmentName(String departmentName) { 31 | this.departmentName = departmentName; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/src/main/java/in/codelearn/model/Person.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.model; 2 | 3 | public class Person { 4 | 5 | private Long personId; 6 | private String firstname; 7 | private String lastname; 8 | 9 | public Person() { 10 | } 11 | public Person(String firstname, String lastname) { 12 | this.firstname = firstname; 13 | this.lastname = lastname; 14 | } 15 | 16 | public Long getPersonId() { 17 | return personId; 18 | } 19 | public void setPersonId(Long personId) { 20 | this.personId = personId; 21 | } 22 | public String getFirstname() { 23 | return firstname; 24 | } 25 | public void setFirstname(String firstname) { 26 | this.firstname = firstname; 27 | } 28 | public String getLastname() { 29 | return lastname; 30 | } 31 | public void setLastname(String lastname) { 32 | this.lastname = lastname; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.Configuration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new Configuration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/src/main/resources/in/codelearn/model/Person.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/target/classes/in/codelearn/model/Person.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneTablePerHeirarchy-XML/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 23:07:05 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=OneTablePerHeirarchy-XML 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\OneTablePerHeirarchy-XML 7 | artifactId=OneTablePerHeirarchy-XML 8 | -------------------------------------------------------------------------------- /OneTablePerHeirarchy-XML/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneTablePerHeirarchy-XML/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | in.codelearn.common 4 | OneTablePerHeirarchy-XML 5 | 0.0.1-SNAPSHOT 6 | war 7 | OneTablePerHeirarchy-XML 8 | One Table Per Heirarchy-XML 9 | 10 | 11 | mysql 12 | mysql-connector-java 13 | 5.1.10 14 | 15 | 16 | org.hibernate 17 | hibernate 18 | 3.2.6.ga 19 | 20 | 21 | -------------------------------------------------------------------------------- /OneTablePerSubclass-Annotation/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /OneTablePerSubclass-Annotation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /OneTablePerSubclass-Annotation/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /OneTablePerSubclass-Annotation/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /OneTablePerSubclass-Annotation/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OneTablePerSubclass-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /OneTablePerSubclass-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /OneTablePerSubclass-Annotation/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /OneTablePerSubclass-Annotation/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /OneTablePerSubclass-Annotation/src/main/java/in/codelearn/common/Main.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.common; 2 | 3 | import in.codelearn.model.Employee; 4 | import in.codelearn.model.Owner; 5 | import in.codelearn.model.Person; 6 | import in.codelearn.persistence.HibernateUtil; 7 | 8 | import java.util.Date; 9 | 10 | import org.hibernate.Session; 11 | import org.hibernate.SessionFactory; 12 | 13 | public class Main { 14 | 15 | public static void main(String[] args) { 16 | 17 | SessionFactory sf = HibernateUtil.getSessionFactory(); 18 | Session session = sf.openSession(); 19 | session.beginTransaction(); 20 | 21 | 22 | Person person = new Person("Steve", "Balmer"); 23 | session.save(person); 24 | 25 | Employee employee = new Employee("James", "Gosling", "Marketing", new Date()); 26 | session.save(employee); 27 | 28 | Owner owner = new Owner("Bill", "Gates", 300L, 20L); 29 | session.save(owner); 30 | 31 | 32 | session.getTransaction().commit(); 33 | session.close(); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /OneTablePerSubclass-Annotation/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /OneTablePerSubclass-Annotation/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /OneTablePerSubclass-Annotation/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneTablePerSubclass-Annotation/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 23:45:06 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=OneTablePerSubclass-Annotation 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\OneTablePerSubclass-Annotation 7 | artifactId=OneTablePerSubclass-Annotation 8 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | in.codelearn.common 4 | OneTablePerSubclass-XML 5 | 0.0.1-SNAPSHOT 6 | war 7 | OneTablePerSubclass-XML 8 | One Table Per Subclass-XML 9 | 10 | 11 | mysql 12 | mysql-connector-java 13 | 5.1.10 14 | 15 | 16 | org.hibernate 17 | hibernate 18 | 3.2.6.ga 19 | 20 | 21 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/src/main/java/in/codelearn/common/Main.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.common; 2 | 3 | import in.codelearn.model.Employee; 4 | import in.codelearn.model.Owner; 5 | import in.codelearn.model.Person; 6 | import in.codelearn.persistence.HibernateUtil; 7 | 8 | import java.util.Date; 9 | 10 | import org.hibernate.Session; 11 | import org.hibernate.SessionFactory; 12 | 13 | public class Main { 14 | 15 | public static void main(String[] args) { 16 | 17 | SessionFactory sf = HibernateUtil.getSessionFactory(); 18 | Session session = sf.openSession(); 19 | session.beginTransaction(); 20 | 21 | 22 | Person person = new Person("Steve", "Balmer"); 23 | session.save(person); 24 | 25 | Employee employee = new Employee("James", "Gosling", "Marketing", new Date()); 26 | session.save(employee); 27 | 28 | Owner owner = new Owner("Bill", "Gates", 300L, 20L); 29 | session.save(owner); 30 | 31 | 32 | session.getTransaction().commit(); 33 | session.close(); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/src/main/java/in/codelearn/model/Employee.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.model; 2 | 3 | import java.util.Date; 4 | 5 | public class Employee extends Person { 6 | 7 | private Date joiningDate; 8 | 9 | private String departmentName; 10 | 11 | public Employee() { 12 | } 13 | 14 | public Employee(String firstname, String lastname, String departmentName, Date joiningDate) { 15 | 16 | super(firstname, lastname); 17 | 18 | this.departmentName = departmentName; 19 | this.joiningDate = joiningDate; 20 | } 21 | 22 | public Date getJoiningDate() { 23 | return joiningDate; 24 | } 25 | public void setJoiningDate(Date joiningDate) { 26 | this.joiningDate = joiningDate; 27 | } 28 | public String getDepartmentName() { 29 | return departmentName; 30 | } 31 | public void setDepartmentName(String departmentName) { 32 | this.departmentName = departmentName; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/src/main/java/in/codelearn/model/Owner.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.model; 2 | 3 | 4 | public class Owner extends Person { 5 | 6 | private Long stocks; 7 | 8 | private Long partnershipStake; 9 | 10 | public Owner() { 11 | } 12 | 13 | public Owner(String firstname, String lastname, Long stocks, Long partnershipStake) { 14 | 15 | super(firstname, lastname); 16 | 17 | this.stocks = stocks; 18 | this.partnershipStake = partnershipStake; 19 | } 20 | 21 | public Long getStocks() { 22 | return stocks; 23 | } 24 | 25 | public void setStocks(Long stocks) { 26 | this.stocks = stocks; 27 | } 28 | 29 | public Long getPartnershipStake() { 30 | return partnershipStake; 31 | } 32 | 33 | public void setPartnershipStake(Long partnershipStake) { 34 | this.partnershipStake = partnershipStake; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/src/main/java/in/codelearn/model/Person.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.model; 2 | 3 | 4 | 5 | public class Person { 6 | 7 | private Long personId; 8 | 9 | private String firstname; 10 | 11 | private String lastname; 12 | 13 | public Person() { 14 | 15 | } 16 | public Person(String firstname, String lastname) { 17 | this.firstname = firstname; 18 | this.lastname = lastname; 19 | } 20 | 21 | public Long getPersonId() { 22 | return personId; 23 | } 24 | public void setPersonId(Long personId) { 25 | this.personId = personId; 26 | } 27 | public String getFirstname() { 28 | return firstname; 29 | } 30 | public void setFirstname(String firstname) { 31 | this.firstname = firstname; 32 | } 33 | public String getLastname() { 34 | return lastname; 35 | } 36 | public void setLastname(String lastname) { 37 | this.lastname = lastname; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.Configuration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new Configuration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneTablePerSubclass-XML/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 23:37:42 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=OneTablePerSubclass-XML 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\OneTablePerSubclass-XML 7 | artifactId=OneTablePerSubclass-XML 8 | -------------------------------------------------------------------------------- /OneTablePerSubclass-XML/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneTablePerSubclass-XML/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | in.codelearn.common 4 | OneTablePerSubclass-XML 5 | 0.0.1-SNAPSHOT 6 | war 7 | OneTablePerSubclass-XML 8 | One Table Per Subclass-XML 9 | 10 | 11 | mysql 12 | mysql-connector-java 13 | 5.1.10 14 | 15 | 16 | org.hibernate 17 | hibernate 18 | 3.2.6.ga 19 | 20 | 21 | -------------------------------------------------------------------------------- /OneToMany-Annotation/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /OneToMany-Annotation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /OneToMany-Annotation/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /OneToMany-Annotation/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /OneToMany-Annotation/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OneToMany-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /OneToMany-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /OneToMany-Annotation/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /OneToMany-Annotation/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /OneToMany-Annotation/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /OneToMany-Annotation/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /OneToMany-Annotation/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneToMany-Annotation/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 21:35:27 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=OneToMany-Annotation 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\OneToMany-Annotation 7 | artifactId=OneToMany-Annotation 8 | -------------------------------------------------------------------------------- /OneToMany-XML/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /OneToMany-XML/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /OneToMany-XML/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /OneToMany-XML/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /OneToMany-XML/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OneToMany-XML/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /OneToMany-XML/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /OneToMany-XML/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /OneToMany-XML/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /OneToMany-XML/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | in.codelearn.common 4 | OneToMany-XML 5 | 0.0.1-SNAPSHOT 6 | war 7 | OneToMany-XML 8 | One to Many Mapping using XML 9 | 10 | 11 | 12 | mysql 13 | mysql-connector-java 14 | 5.1.10 15 | 16 | 17 | org.hibernate 18 | hibernate 19 | 3.2.6.ga 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /OneToMany-XML/src/main/java/in/codelearn/model/Department.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.model; 2 | 3 | import java.util.List; 4 | 5 | 6 | public class Department { 7 | 8 | private Long departmentId; 9 | 10 | private String departmentName; 11 | 12 | private List employees; 13 | 14 | public Long getDepartmentId() { 15 | return departmentId; 16 | } 17 | 18 | public void setDepartmentId(Long departmentId) { 19 | this.departmentId = departmentId; 20 | } 21 | 22 | public String getDepartmentName() { 23 | return departmentName; 24 | } 25 | 26 | public void setDepartmentName(String departmentName) { 27 | this.departmentName = departmentName; 28 | } 29 | 30 | public List getEmployees() { 31 | return employees; 32 | } 33 | 34 | public void setEmployees(List employees) { 35 | this.employees = employees; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /OneToMany-XML/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.Configuration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new Configuration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /OneToMany-XML/src/main/resources/in/codelearn/persistence/Department.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /OneToMany-XML/target/classes/in/codelearn/persistence/Department.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /OneToMany-XML/target/classes/in/codelearn/persistence/Employee.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /OneToMany-XML/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /OneToMany-XML/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneToMany-XML/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 20:12:53 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=OneToMany-XML 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\OneToMany-XML 7 | artifactId=OneToMany-XML 8 | -------------------------------------------------------------------------------- /OneToMany-XML/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneToMany-XML/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | in.codelearn.common 4 | OneToMany-XML 5 | 0.0.1-SNAPSHOT 6 | war 7 | OneToMany-XML 8 | One to Many Mapping using XML 9 | 10 | 11 | 12 | mysql 13 | mysql-connector-java 14 | 5.1.10 15 | 16 | 17 | org.hibernate 18 | hibernate 19 | 3.2.6.ga 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /OneToOne-Annotation/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /OneToOne-Annotation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /OneToOne-Annotation/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /OneToOne-Annotation/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /OneToOne-Annotation/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OneToOne-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /OneToOne-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /OneToOne-Annotation/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /OneToOne-Annotation/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /OneToOne-Annotation/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /OneToOne-Annotation/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /OneToOne-Annotation/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneToOne-Annotation/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 19:57:23 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=OneToOne-Annotation 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\OneToOne-Annotation 7 | artifactId=OneToOne-Annotation 8 | -------------------------------------------------------------------------------- /OneToOne-XML/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /OneToOne-XML/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /OneToOne-XML/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /OneToOne-XML/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /OneToOne-XML/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OneToOne-XML/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /OneToOne-XML/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /OneToOne-XML/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /OneToOne-XML/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /OneToOne-XML/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | in.codelearn.common 4 | OneToOne-XML 5 | 0.0.1-SNAPSHOT 6 | war 7 | OneToOne-XML 8 | One to One Mapping using XML 9 | 10 | 11 | mysql 12 | mysql-connector-java 13 | 5.1.10 14 | 15 | 16 | org.hibernate 17 | hibernate 18 | 3.2.6.ga 19 | 20 | 21 | -------------------------------------------------------------------------------- /OneToOne-XML/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.Configuration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new Configuration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /OneToOne-XML/src/main/resources/in/codelearn/model/Employee.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /OneToOne-XML/src/main/resources/in/codelearn/model/EmployeeDetail.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | employee 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /OneToOne-XML/target/classes/in/codelearn/model/Employee.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /OneToOne-XML/target/classes/in/codelearn/model/EmployeeDetail.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | employee 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /OneToOne-XML/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /OneToOne-XML/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneToOne-XML/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 08:18:32 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=OneToOne-XML 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\OneToOne-XML 7 | artifactId=OneToOne-XML 8 | -------------------------------------------------------------------------------- /OneToOne-XML/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/OneToOne-XML/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | in.codelearn.common 4 | OneToOne-XML 5 | 0.0.1-SNAPSHOT 6 | war 7 | OneToOne-XML 8 | One to One Mapping using XML 9 | 10 | 11 | mysql 12 | mysql-connector-java 13 | 5.1.10 14 | 15 | 16 | org.hibernate 17 | hibernate 18 | 3.2.6.ga 19 | 20 | 21 | -------------------------------------------------------------------------------- /PrintQueryString/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /PrintQueryString/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /PrintQueryString/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /PrintQueryString/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /PrintQueryString/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PrintQueryString/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /PrintQueryString/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /PrintQueryString/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /PrintQueryString/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /PrintQueryString/src/main/java/com/supportmycode/dao/App.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.dao; 2 | 3 | import java.sql.Date; 4 | 5 | import org.hibernate.Session; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | import com.supportmycode.model.Employee; 10 | import com.supportmycode.persistence.HibernateUtil; 11 | 12 | 13 | public class App 14 | { 15 | final static Logger logger = LoggerFactory.getLogger(App.class); 16 | 17 | public static void main( String[] args ) 18 | { 19 | 20 | logger.info("Hibernate Example Annotations"); 21 | Session session = HibernateUtil.getSessionFactory().openSession(); 22 | 23 | session.beginTransaction(); 24 | Employee emp = new Employee("James", "Bond", new Date(System.currentTimeMillis()), "007"); 25 | 26 | session.save(emp); 27 | session.getTransaction().commit(); 28 | session.close(); 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /PrintQueryString/src/main/java/com/supportmycode/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /PrintQueryString/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Set root logger level to DEBUG and its only appender to A1. 2 | log4j.rootLogger=DEBUG, A1 3 | 4 | # A1 is set to be a ConsoleAppender. 5 | log4j.appender.A1=org.apache.log4j.ConsoleAppender 6 | 7 | # A1 uses PatternLayout. 8 | log4j.appender.A1.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 10 | 11 | # logs the SQL statements 12 | log4j.logger.org.hibernate.SQL=debug 13 | 14 | # Logs the JDBC parameters passed to a query 15 | log4j.logger.org.hibernate.type=trace -------------------------------------------------------------------------------- /PrintQueryString/src/main/resources/tables.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `employee` ( 2 | `id` BIGINT(10) NOT NULL AUTO_INCREMENT, 3 | `firstname` VARCHAR(50) NULL DEFAULT NULL, 4 | `lastname` VARCHAR(50) NULL DEFAULT NULL, 5 | `birth_date` DATE NOT NULL, 6 | `cell_phone` VARCHAR(15) NOT NULL, 7 | PRIMARY KEY (`id`) 8 | ); -------------------------------------------------------------------------------- /PrintQueryString/target/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | # Set root logger level to DEBUG and its only appender to A1. 2 | log4j.rootLogger=DEBUG, A1 3 | 4 | # A1 is set to be a ConsoleAppender. 5 | log4j.appender.A1=org.apache.log4j.ConsoleAppender 6 | 7 | # A1 uses PatternLayout. 8 | log4j.appender.A1.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 10 | 11 | # logs the SQL statements 12 | log4j.logger.org.hibernate.SQL=debug 13 | 14 | # Logs the JDBC parameters passed to a query 15 | log4j.logger.org.hibernate.type=trace -------------------------------------------------------------------------------- /PrintQueryString/target/classes/tables.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `employee` ( 2 | `id` BIGINT(10) NOT NULL AUTO_INCREMENT, 3 | `firstname` VARCHAR(50) NULL DEFAULT NULL, 4 | `lastname` VARCHAR(50) NULL DEFAULT NULL, 5 | `birth_date` DATE NOT NULL, 6 | `cell_phone` VARCHAR(15) NOT NULL, 7 | PRIMARY KEY (`id`) 8 | ); -------------------------------------------------------------------------------- /PrintQueryString/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /PrintQueryString/target/m2e-wtp/web-resources/META-INF/maven/com.supportmycode.dao/PrintQueryString/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Wed Aug 20 08:18:10 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.supportmycode.dao 5 | m2e.projectName=PrintQueryString 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\PrintQueryString 7 | artifactId=PrintQueryString 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | hibernate 2 | ========= 3 | 4 | Examples related to Hibernate framework 5 | 6 | For Hibernate tutorial, tricks and tips visit - http://supportmycode.com/ 7 | -------------------------------------------------------------------------------- /ReattachDetachedObject/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ReattachDetachedObject/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /ReattachDetachedObject/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /ReattachDetachedObject/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ReattachDetachedObject/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ReattachDetachedObject/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /ReattachDetachedObject/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /ReattachDetachedObject/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /ReattachDetachedObject/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /ReattachDetachedObject/src/main/java/com/supportmycode/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /ReattachDetachedObject/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /ReattachDetachedObject/target/m2e-wtp/web-resources/META-INF/maven/com.supportmycode.dao/ReattachDetachedObject/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Mon Aug 25 08:46:53 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.supportmycode.dao 5 | m2e.projectName=ReattachDetachedObject 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\ReattachDetachedObject 7 | artifactId=ReattachDetachedObject 8 | -------------------------------------------------------------------------------- /SecondLevelCache/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /SecondLevelCache/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /SecondLevelCache/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /SecondLevelCache/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /SecondLevelCache/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SecondLevelCache/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /SecondLevelCache/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /SecondLevelCache/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /SecondLevelCache/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /SecondLevelCache/src/main/java/com/supportmycode/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /SecondLevelCache/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /SecondLevelCache/target/m2e-wtp/web-resources/META-INF/maven/com.supportmycode.dao/SecondLevelCache/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Fri Aug 29 12:03:52 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.supportmycode.dao 5 | m2e.projectName=SecondLevelCache 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\SecondLevelCache 7 | artifactId=SecondLevelCache 8 | -------------------------------------------------------------------------------- /SelfReference-ManyToMany-Annotation/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /SelfReference-ManyToMany-Annotation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /SelfReference-ManyToMany-Annotation/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /SelfReference-ManyToMany-Annotation/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SelfReference-ManyToMany-Annotation/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SelfReference-ManyToMany-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /SelfReference-ManyToMany-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /SelfReference-ManyToMany-Annotation/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /SelfReference-ManyToMany-Annotation/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /SelfReference-ManyToMany-Annotation/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /SelfReference-ManyToMany-Annotation/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /SelfReference-ManyToMany-Annotation/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/SelfReference-ManyToMany-Annotation/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 22:52:43 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=SelfReference-ManyToMany-Annotation 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\SelfReference-ManyToMany-Annotation 7 | artifactId=SelfReference-ManyToMany-Annotation 8 | -------------------------------------------------------------------------------- /SelfReference-OneToMany-Annotation/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /SelfReference-OneToMany-Annotation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /SelfReference-OneToMany-Annotation/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /SelfReference-OneToMany-Annotation/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SelfReference-OneToMany-Annotation/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SelfReference-OneToMany-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /SelfReference-OneToMany-Annotation/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /SelfReference-OneToMany-Annotation/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /SelfReference-OneToMany-Annotation/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /SelfReference-OneToMany-Annotation/src/main/java/in/codelearn/common/Main.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.common; 2 | 3 | import in.codelearn.model.Employee; 4 | import in.codelearn.persistence.HibernateUtil; 5 | 6 | import org.hibernate.Session; 7 | import org.hibernate.SessionFactory; 8 | 9 | public class Main { 10 | 11 | public static void main(String[] args) { 12 | 13 | SessionFactory sf = HibernateUtil.getSessionFactory(); 14 | Session session = sf.openSession(); 15 | session.beginTransaction(); 16 | 17 | Employee manager1 = new Employee("Chuck", "Norris"); 18 | 19 | Employee employee1 = new Employee("Sergey", "Brin"); 20 | Employee employee2 = new Employee("Larry", "Page"); 21 | 22 | employee1.setManager(manager1); 23 | employee2.setManager(manager1); 24 | 25 | session.save(employee1); 26 | session.save(employee2); 27 | 28 | session.getTransaction().commit(); 29 | session.close(); 30 | } 31 | } -------------------------------------------------------------------------------- /SelfReference-OneToMany-Annotation/src/main/java/in/codelearn/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package in.codelearn.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /SelfReference-OneToMany-Annotation/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /SelfReference-OneToMany-Annotation/target/m2e-wtp/web-resources/META-INF/maven/in.codelearn.common/SelfReference-OneToMany-Annotation/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 14 22:36:33 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=in.codelearn.common 5 | m2e.projectName=SelfReference-OneToMany-Annotation 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\SelfReference-OneToMany-Annotation 7 | artifactId=SelfReference-OneToMany-Annotation 8 | -------------------------------------------------------------------------------- /TableGenerator/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /TableGenerator/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /TableGenerator/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /TableGenerator/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /TableGenerator/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TableGenerator/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /TableGenerator/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /TableGenerator/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /TableGenerator/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /TableGenerator/src/main/java/com/supportmycode/dao/Main.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.dao; 2 | 3 | import org.hibernate.Session; 4 | import org.hibernate.SessionFactory; 5 | 6 | import com.supportmycode.model.Employee; 7 | import com.supportmycode.persistence.HibernateUtil; 8 | 9 | public class Main { 10 | 11 | @SuppressWarnings("unchecked") 12 | public static void main(String[] args) { 13 | 14 | SessionFactory sf = HibernateUtil.getSessionFactory(); 15 | Session session = sf.openSession(); 16 | session.beginTransaction(); 17 | 18 | Employee emp1 = new Employee("Nina", "Mayers", "111"); 19 | 20 | session.save(emp1); 21 | session.getTransaction().commit(); 22 | session.close(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /TableGenerator/src/main/java/com/supportmycode/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /TableGenerator/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /TableGenerator/target/m2e-wtp/web-resources/META-INF/maven/com.supportmycode.dao/TableGenerator/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Aug 21 22:07:26 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.supportmycode.dao 5 | m2e.projectName=TableGenerator 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\TableGenerator 7 | artifactId=TableGenerator 8 | -------------------------------------------------------------------------------- /hbm2ddl.auto/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /hbm2ddl.auto/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /hbm2ddl.auto/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /hbm2ddl.auto/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /hbm2ddl.auto/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /hbm2ddl.auto/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /hbm2ddl.auto/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /hbm2ddl.auto/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /hbm2ddl.auto/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration= 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /hbm2ddl.auto/src/main/java/com/supportmycode/dao/App.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.dao; 2 | 3 | import java.sql.Date; 4 | 5 | import org.hibernate.Session; 6 | 7 | import com.supportmycode.model.Employee; 8 | import com.supportmycode.persistence.HibernateUtil; 9 | 10 | 11 | public class App 12 | { 13 | public static void main( String[] args ) 14 | { 15 | System.out.println("Hibernate Example Annotations"); 16 | Session session = HibernateUtil.getSessionFactory().openSession(); 17 | 18 | session.beginTransaction(); 19 | Employee emp = new Employee("James", "Bond", new Date(System.currentTimeMillis()), "007"); 20 | 21 | session.save(emp); 22 | session.getTransaction().commit(); 23 | session.close(); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /hbm2ddl.auto/src/main/java/com/supportmycode/persistence/HibernateUtil.java: -------------------------------------------------------------------------------- 1 | package com.supportmycode.persistence; 2 | 3 | import org.hibernate.SessionFactory; 4 | import org.hibernate.cfg.AnnotationConfiguration; 5 | 6 | public class HibernateUtil { 7 | 8 | private static final SessionFactory sessionFactory = buildSessionFactory(); 9 | 10 | private static SessionFactory buildSessionFactory() { 11 | try { 12 | // Create the SessionFactory from hibernate.cfg.xml 13 | return new AnnotationConfiguration() 14 | .configure() 15 | .buildSessionFactory(); 16 | } catch (Throwable ex) { 17 | System.err.println("Initial SessionFactory creation failed." + ex); 18 | throw new ExceptionInInitializerError(ex); 19 | } 20 | } 21 | 22 | public static SessionFactory getSessionFactory() { 23 | return sessionFactory; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /hbm2ddl.auto/src/main/resources/tables.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `employee` ( 2 | `id` BIGINT(10) NOT NULL AUTO_INCREMENT, 3 | `firstname` VARCHAR(50) NULL DEFAULT NULL, 4 | `lastname` VARCHAR(50) NULL DEFAULT NULL, 5 | `birth_date` DATE NOT NULL, 6 | `cell_phone` VARCHAR(15) NOT NULL, 7 | PRIMARY KEY (`id`) 8 | ); -------------------------------------------------------------------------------- /hbm2ddl.auto/target/classes/tables.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `employee` ( 2 | `id` BIGINT(10) NOT NULL AUTO_INCREMENT, 3 | `firstname` VARCHAR(50) NULL DEFAULT NULL, 4 | `lastname` VARCHAR(50) NULL DEFAULT NULL, 5 | `birth_date` DATE NOT NULL, 6 | `cell_phone` VARCHAR(15) NOT NULL, 7 | PRIMARY KEY (`id`) 8 | ); -------------------------------------------------------------------------------- /hbm2ddl.auto/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Viresh 3 | Build-Jdk: 1.7.0_51 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /hbm2ddl.auto/target/m2e-wtp/web-resources/META-INF/maven/com.supportmycode.dao/hbm2ddl.auto/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Tue Aug 19 22:26:51 IST 2014 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.supportmycode.dao 5 | m2e.projectName=hbm2ddl.auto 6 | m2e.projectLocation=D\:\\WorkSpace\\Vasu\\hbm2ddl.auto 7 | artifactId=hbm2ddl.auto 8 | --------------------------------------------------------------------------------