The jar deployed without any problems. The EJBPU is defined in persistrence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="
http://java.sun.com/xml/ns/persistence" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="EJBPU" transaction-type="JTA">
<jta-data-source>jdbc/funnyJNDI</jta-data-source>
<properties/>
</persistence-unit>
</persistence>
The line 27 is this one:
lib.setIsbn(isbn);
in the method addBook.
The entity bean looks as follows:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package entity;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
/**
*
* @author Nupek
*/
@Entity
@Table(name = "book")
@NamedQueries({_at_NamedQuery(name = "Book.findByIsbn", query = "SELECT b FROM Book b WHERE b.isbn = :isbn"), @NamedQuery(name = "Book.findByAuthor", query = "SELECT b FROM Book b WHERE b.author = :author"), @NamedQuery(name = "Book.findByTitle", query = "SELECT b FROM Book b WHERE b.title = :title")})
public class Book implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "isbn", nullable = false)
private String isbn;
@Column(name = "author")
private String author;
@Column(name = "title")
private String title;
public Book() {
}
public Book(String isbn) {
this.isbn = isbn;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public int hashCode() {
int hash = 0;
hash += (isbn != null ? isbn.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Book)) {
return false;
}
Book other = (Book) object;
if ((this.isbn == null && other.isbn != null) || (this.isbn != null && !this.isbn.equals(other.isbn))) {
return false;
}
return true;
}
@Override
public String toString() {
return "entity.Book[isbn=" + isbn + "]";
}
}
[Message sent by forum member 'nupek' (nupek)]
http://forums.java.net/jive/thread.jspa?messageID=346670