JBoss Community

Re: xa-datasource x creating tables in both database

created by Luciano Borges in Datasource Configuration - View the full discussion

Hi Wolf.

 

My war look like this:

 

twophasecommit.war

`-- WEB-INF

    |-- classes

    |   |-- example

    |   |   `-- twophasecommit

    |   |       |-- entity

    |   |       |   |-- Book.class

    |   |       |   `-- BookSummary.class

    |   |       `-- persistence

    |   |           |-- BookDAO.class

    |   |           `-- BookSummaryDAO.class

    |   |-- META-INF

    |   |   `-- persistence.xml

    |-- lib

    |  

    `-- web.xml

 

My JBoss is 6.1.

 

My entities:

 

package example.twophasecommit.domain;

import java.io.Serializable;

import javax.persistence.Column;

import javax.persistence.Entity;

import javax.persistence.GeneratedValue;

import javax.persistence.Id;

 

@Entity

public class Book implements Serializable {

 

private static final long serialVersionUID = 1L;

 

          @Id

          @GeneratedValue

          private Long id;

 

          @Column

          private String title;

 

          @Column

          private String author;

 

          public Book() {

                    super();

          }

 

          public Book(String title, String author) {

                    this.title = title;

                    this.author = author;

          }

 

          public Long getId() {

                    return id;

          }

 

          public void setId(Long id) {

                    this.id = id;

          }

 

  public String getTitle() {

                    return title;

          }

 

          public void setTitle(String title) {

                    this.title = title;

          }

 

          public String getAuthor() {

                    return author;

          }

 

          public void setAuthor(String author) {

                    this.author = author;

          }

}

---------------

package example.twophasecommit.domain;

import java.io.Serializable;

import javax.persistence.Entity;

import javax.persistence.Id;

 

@Entity

public class BookSummary implements Serializable{

 

          private static final long serialVersionUID = 1L;

 

          @Id

          private int id;

 

          private String summary;

 

          public String getSummary() {

                    return summary;

          }

 

          public void setSummary(String summary) {

                    this.summary = summary;

          }

 

          public void setId(int id) {

                    this.id = id;

          }

 

          public int getId() {

                    return id;

          }

 

}

 

Thanks,

Luciano

Reply to this message by going to Community

Start a new discussion in Datasource Configuration at Community