Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Entity
- @Table(name="pushmaster")
- public class Pushdata {
- @Id
- @SequenceGenerator(name = "pushmaster_id_seq",
- sequenceName = "pushmaster_id_seq",
- allocationSize = 1)
- @GeneratedValue (strategy = GenerationType.SEQUENCE,
- generator = "pushmaster_id_seq")
- @Column(name="id", unique = true)
- public int id;
- private String title;
- private String content;
- public Pushdata (){
- }
- public Pushdata (String title, String content){
- this.title=title;
- this.content=content;
- }
- @Column(name = "title")
- public String getTitle() {
- return title;
- }
- public void setTitle(String title) {
- this.title = title;
- }
- @Column(name = "content")
- public String getContent() {
- return content;
- }
- public void setContent(String content) {
- this.content = content;
- }
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }}
- (List<Pushdata>)
- factoryClass.getSessionFactory().
- openSession().createQuery(" from Pushdata" ).list();
- <hibernate-configuration>
- <session-factory>
- <property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
- <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQL94Dialect</property>
- <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/</property>
- <property name="hibernate.connection.username">postgres</property>
- <property name="hibernate.connection.password">password</property>
- <property name="connection_pool_size">1</property>
- <property name="hbm2ddl.auto">update</property>
- <property name="hibernate.connection.autocommit">true</property>
- <property name="show_sql">true</property>
- <mapping class="ru.spb.Pushdata"/>
- </session-factory>
Add Comment
Please, Sign In to add comment