java - Data is not storing using hibernate in multiple tables in PostgreSQL -


i new hibernate. trying store data using hibernate didn't go through. can not find data in account table in database.

i found somewhere need deal cascade. i'm not sure how implement that.

thanks help.

console output

hibernate: select nextval ('hibernate_sequence') hibernate: select nextval ('hibernate_sequence') 

controller code store data

address address = new address(); //setting address properties. company newcompany = new company(); address.setcompany(newcompany);  addressdao.saveaddress(address); 

address.java

private static final long serialversionuid = 1l;  @id @generatedvalue @column(name="id") private long id;  private string type;  @column(name = "street") private string street;  @column(name = "city") private string city;  @column(name = "zipcode") private string zipcode;  @column(name = "country") private string country;  @manytoone(cascade=cascadetype.merge) private user user;  @manytoone(cascade=cascadetype.merge) private company company;  public long getid() {     return id; }  public void setid(long id) {     this.id = id; }  public string gettype() {     return type; }  public void settype(string type) {     this.type = type; }  public string getstreet() {     return street; }  public void setstreet(string street) {     this.street = street; }  public string getcity() {     return city; }  public void setcity(string city) {     this.city = city; }  public string getzipcode() {     return zipcode; }  public void setzipcode(string zipcode) {     this.zipcode = zipcode; }  public string getcountry() {     return country; }  public void setcountry(string country) {     this.country = country; }  public user getuser() {     return user; }  public void setuser(user user) {     this.user = user; }  public company getcompany() {     return company; }  public void setcompany(company company) {     this.company = company; } 

company.java

private static final long serialversionuid = 1l; @id @generatedvalue private int companyid;  @onetomany(mappedby="company", cascade=cascadetype.merge) list<address> address;  public company() {  }  public int getcompanyid() {     return companyid; }  public void setcompanyid(int companyid) {     this.companyid = companyid; }  public list<address> getaddress() {     return address; }  public void setaddress(list<address> address) {     this.address = address; } 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -