When trying to use a SOAP client with JBOSS I found lot of problems. In particular, I was able to deploy some WSDL files inside the JBOSS server but, when I tried to use them creating a SOAP web service client, JBOSS comes out with lot of errors, each one that said
Exception in thread "main" java.lang.IllegalArgumentException: Cannot obtain wsdl service: {http://localhost:8080/ggServices/CalculatorBean}CalculatorService at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaDataInternal(JAXRPCClientMetaDataBuilder.java:171)at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaData(JAXRPCClientMetaDataBuilder.java:133)
at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaData(JAXRPCClientMetaDataBuilder.java:85)
at org.jboss.ws.core.jaxrpc.client.ServiceImpl.<init>(ServiceImpl.java:111)
at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:128)
at org.bilgidata.kitapdemo.service.Client.main(Client.java:18
I found around the Web lot of stuff talking about this problem, and it seems that JBOSS have some problem with SOAP clients (especially for my JBOSS version 5.1.0.GA ).
For this I change from SOAP to REST and everything works!
Thursday, March 31, 2011
Saturday, March 26, 2011
[Java>JavaMail] java.lang.SecurityException: "Access to default session denied" occures.
I found lot of problems when trying to send an email through java.
The first time I recompiled and restarted my application everything seems to work fine.
At the first time my application was able to correctly send an email to the desired e-mail address. Once this email was sent, there was no hope to resend another email to another (or same) address.
The stack trace said:
[Java>JavaMail] java.lang.SecurityException: "Access to default session denied" occures.
And lot of error messages...The stack trace said that the error was at the line in which my application perform the call to the send mail code class.
Here is the problem.
This error is raised in the getDefaultInstance method in javax.mail.Session.java. According.It occurs when this session has been already initialized, used or recharged recompiling the whole application everything work...
HOW TO FIX THIS PROBLEM?
Well, it's very simple write a singleton class for the send mail code class and everything works perfectly!
The first time I recompiled and restarted my application everything seems to work fine.
At the first time my application was able to correctly send an email to the desired e-mail address. Once this email was sent, there was no hope to resend another email to another (or same) address.
The stack trace said:
[Java>JavaMail] java.lang.SecurityException: "Access to default session denied" occures.
And lot of error messages...The stack trace said that the error was at the line in which my application perform the call to the send mail code class.
Here is the problem.
This error is raised in the getDefaultInstance method in javax.mail.Session.java. According.It occurs when this session has been already initialized, used or recharged recompiling the whole application everything work...
HOW TO FIX THIS PROBLEM?
Well, it's very simple write a singleton class for the send mail code class and everything works perfectly!
Saturday, February 26, 2011
EJB: cannot fetch multiple bags
This problem is given when we try to fetch at the same time more than one object with relation One-to-many, Many-to-one or Many-to-many.
There are several way for solving this problem, one of them is not working for me but the one that I'm going to explain works perfectly.
Let us assume that we have three entity:
BOOK
AUTHOR
ORDER
A book has a relation Many-To-Many with Author
and Order has relation Many-To-Many with Book
Let us take as example the entity book and author as the one used in the previous post named: EJB:many to many relation
and let us add the entity Order:
-----------------------
public class Orders implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "Order_Id")
private Integer Order_Id;
@Basic(optional = false)
@Column(name = "Refers_To")
private String refersTo;
@Basic(optional = false)
@Column(name = "Price_Amount")
private double priceAmount;
@Basic(optional = false)
@Column(name = "OrderDate")
private String orderDate;
@Basic(optional = false)
@Column(name = "Deleted")
private boolean deleted;
@JoinTable(name = "ORDERS_BOOK", joinColumns = {
@JoinColumn(name = "Order_Id", referencedColumnName = "Order_Id")}, inverseJoinColumns = {
@JoinColumn(name = "Book_Id", referencedColumnName = "Book_Id")})
@ManyToMany(cascade = {CascadeType.MERGE}, fetch=FetchType.EAGER)
private List<Book> bookList;
public Orders() {
}
public Orders(Integer Order_Id) {
this.Order_Id = Order_Id;
}
public Orders(Integer Order_Id, String refersTo, double priceAmount, String orderDate, boolean deleted) {
this.Order_Id = Order_Id;
this.refersTo = refersTo;
this.priceAmount = priceAmount;
this.orderDate = orderDate;
this.deleted = deleted;
}
public Integer getOrder_Id() {
return Order_Id;
}
public void setOrder_Id(Integer Order_Id) {
this.Order_Id = Order_Id;
}
public String getRefersTo() {
return refersTo;
}
public void setRefersTo(String refersTo) {
this.refersTo = refersTo;
}
public double getPriceAmount() {
return priceAmount;
}
public void setPriceAmount(double priceAmount) {
this.priceAmount = priceAmount;
}
public String getOrderDate() {
return orderDate;
}
public void setOrderDate(String orderDate) {
this.orderDate = orderDate;
}
public boolean getDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
public List<Book> getBookList() {
return bookSet;
}
public void setBookList(List<Book> bookList) {
this.bookSet = bookSet;
}
@Override
public int hashCode() {
int hash = 0;
hash += (Order_Id != null ? Order_Id.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 Orders)) {
return false;
}
Orders other = (Orders) object;
if ((this.Order_Id == null && other.Order_Id != null) || (this.Order_Id != null && !this.Order_Id.equals(other.Order_Id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "entity.Orders[Order_Id=" + Order_Id + "]";
}
}
In this case when compiling, jboss, will gave us the exception
"javax.persistence.PersistenceException: org.ejb3unit.hibernate.HibernateException: cannot simultaneously fetch multiple bags"
WORKAROUND
A workaround for this is to use Set instead of List in entity Order for example (or Book...or any other entity in which we are using a list for a many to many, one to many, many to one relation). Do you really need a List?? Or is it enough to have a Set??
(I know list is more comfortable....but we can add in the getter and setter mode some code that transform our ugly set in a wonderful list! ;) )
Let us turn back to the problem! This issue arised by Hibernate is that it is not able to load automatically more than one collection at a time, using a set instead we are able to load multiple collection in a EAGER fetchType manner.
The previous bookList will become a bookSet. I'll put how the new bookList looks like:
@JoinTable(name = "ORDERS_BOOK", joinColumns = {
@JoinColumn(name = "Order_Id", referencedColumnName = "Order_Id")}, inverseJoinColumns = {
@JoinColumn(name = "Book_Id", referencedColumnName = "Book_Id")})
@ManyToMany(cascade = {CascadeType.MERGE}, fetch=FetchType.EAGER)
private Set<Book> bookSet;
With its proper getter and setter. In this way we have fixed this problem.
Note that also using a LAZY fetchType we will solve this problem, but if we need
the compete object to be loaded (as it was the case in this explanation), LAZY fetch type is completely useless and wrong.
There are several way for solving this problem, one of them is not working for me but the one that I'm going to explain works perfectly.
Let us assume that we have three entity:
BOOK
AUTHOR
ORDER
A book has a relation Many-To-Many with Author
and Order has relation Many-To-Many with Book
Let us take as example the entity book and author as the one used in the previous post named: EJB:many to many relation
and let us add the entity Order:
-----------------------
public class Orders implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "Order_Id")
private Integer Order_Id;
@Basic(optional = false)
@Column(name = "Refers_To")
private String refersTo;
@Basic(optional = false)
@Column(name = "Price_Amount")
private double priceAmount;
@Basic(optional = false)
@Column(name = "OrderDate")
private String orderDate;
@Basic(optional = false)
@Column(name = "Deleted")
private boolean deleted;
@JoinTable(name = "ORDERS_BOOK", joinColumns = {
@JoinColumn(name = "Order_Id", referencedColumnName = "Order_Id")}, inverseJoinColumns = {
@JoinColumn(name = "Book_Id", referencedColumnName = "Book_Id")})
@ManyToMany(cascade = {CascadeType.MERGE}, fetch=FetchType.EAGER)
private List<Book> bookList;
public Orders() {
}
public Orders(Integer Order_Id) {
this.Order_Id = Order_Id;
}
public Orders(Integer Order_Id, String refersTo, double priceAmount, String orderDate, boolean deleted) {
this.Order_Id = Order_Id;
this.refersTo = refersTo;
this.priceAmount = priceAmount;
this.orderDate = orderDate;
this.deleted = deleted;
}
public Integer getOrder_Id() {
return Order_Id;
}
public void setOrder_Id(Integer Order_Id) {
this.Order_Id = Order_Id;
}
public String getRefersTo() {
return refersTo;
}
public void setRefersTo(String refersTo) {
this.refersTo = refersTo;
}
public double getPriceAmount() {
return priceAmount;
}
public void setPriceAmount(double priceAmount) {
this.priceAmount = priceAmount;
}
public String getOrderDate() {
return orderDate;
}
public void setOrderDate(String orderDate) {
this.orderDate = orderDate;
}
public boolean getDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
public List<Book> getBookList() {
return bookSet;
}
public void setBookList(List<Book> bookList) {
this.bookSet = bookSet;
}
@Override
public int hashCode() {
int hash = 0;
hash += (Order_Id != null ? Order_Id.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 Orders)) {
return false;
}
Orders other = (Orders) object;
if ((this.Order_Id == null && other.Order_Id != null) || (this.Order_Id != null && !this.Order_Id.equals(other.Order_Id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "entity.Orders[Order_Id=" + Order_Id + "]";
}
}
In this case when compiling, jboss, will gave us the exception
"javax.persistence.PersistenceException: org.ejb3unit.hibernate.HibernateException: cannot simultaneously fetch multiple bags"
WORKAROUND
A workaround for this is to use Set instead of List in entity Order for example (or Book...or any other entity in which we are using a list for a many to many, one to many, many to one relation). Do you really need a List?? Or is it enough to have a Set??
(I know list is more comfortable....but we can add in the getter and setter mode some code that transform our ugly set in a wonderful list! ;) )
Let us turn back to the problem! This issue arised by Hibernate is that it is not able to load automatically more than one collection at a time, using a set instead we are able to load multiple collection in a EAGER fetchType manner.
The previous bookList will become a bookSet. I'll put how the new bookList looks like:
@JoinTable(name = "ORDERS_BOOK", joinColumns = {
@JoinColumn(name = "Order_Id", referencedColumnName = "Order_Id")}, inverseJoinColumns = {
@JoinColumn(name = "Book_Id", referencedColumnName = "Book_Id")})
@ManyToMany(cascade = {CascadeType.MERGE}, fetch=FetchType.EAGER)
private Set<Book> bookSet;
With its proper getter and setter. In this way we have fixed this problem.
Note that also using a LAZY fetchType we will solve this problem, but if we need
the compete object to be loaded (as it was the case in this explanation), LAZY fetch type is completely useless and wrong.
EJB:many to many relation
One of the biggest problem that I found while working with EJB is to set up a working many to many relation between two Enterprise Java Beans.
Without losing in generality let us assume that we have a relation Book - Authors.
As we can imagine a Book could have more than one author and an Author could have written more then one book.
We want to model two EJBs in a way that when we want to store a book into our DBs, automatically the system saves (or merge Depend whether the author is already present in the DB) the authors.
As clarification let me put the two EJBs
The first piece of code is the Book Entity
-----------------------
public class Book implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "Book_Id")
private Integer Book_Id;
@Basic(optional = false)
@Column(name = "Title")
private String title;
@Basic(optional = false)
@Column(name = "Pub_Date")
private String pubDate;
@Basic(optional = false)
@Column(name = "Price")
private double price;
@Basic(optional = false)
@Column(name = "Quantity")
private int quantity;
@Basic(optional = false)
@Column(name = "Deleted")
private boolean deleted;
@JoinTable(name = "BOOK_AUTHOR", joinColumns = {
@JoinColumn(name = "Book_Id", referencedColumnName = "Book_Id")}, inverseJoinColumns = {
@JoinColumn(name = "Author_Id", referencedColumnName = "Author_Id")})
@ManyToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
private List<Author> authorList;
public Book() {
}
public Book(Integer Book_Id) {
this.Book_Id = Book_Id;
}
public Book(Integer Book_Id, String title, String pubDate, double price, int quantity, boolean deleted) {
this.Book_Id = Book_Id;
this.title = title;
this.pubDate = pubDate;
this.price = price;
this.quantity = quantity;
this.deleted = deleted;
}
public Integer getBook_Id() {
return Book_Id;
}
public void setBook_Id(Integer Book_Id) {
this.Book_Id = Book_Id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPubDate() {
return pubDate;
}
public void setPubDate(String pubDate) {
this.pubDate = pubDate;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public boolean getDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
@Override
public int hashCode() {
int hash = 0;
hash += (Book_Id != null ? Book_Id.hashCode() : 0);
return hash;
}
public List<Author> getAuthorList() {
return authorList;
}
public void setAuthorList(List<Author> authorList) {
this.authorList = authorList;
}
@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.Book_Id == null && other.Book_Id != null) || (this.Book_Id != null && !this.Book_Id.equals(other.Book_Id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "entity.Book[Book_Id=" + Book_Id + "]";
}
}
-----------------------
And the second is the Author entity
-----------------------
public class Author implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "Author_Id")
private Integer Author_Id;
@Basic(optional = false)
@Column(name = "Name")
private String name;
@Basic(optional = false)
@Column(name = "Surname")
private String surname;
@Basic(optional = false)
@Column(name = "Email")
private String email;
@Basic(optional = false)
@Column(name = "Deleted")
private boolean deleted;
public Author() {
}
public Author(Integer Author_Id) {
this.Author_Id = Author_Id;
}
public Author(Integer Author_Id, String name, String surname, String email, boolean deleted) {
this.Author_Id = Author_Id;
this.name = name;
this.surname = surname;
this.email = email;
this.deleted = deleted;
}
public Integer getAuthorId() {
return Author_Id;
}
public void setAuthorId(Integer Author_Id) {
this.Author_Id = Author_Id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public boolean getDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
@Override
public int hashCode() {
int hash = 0;
hash += (Author_Id != null ? Author_Id.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 Author)) {
return false;
}
Author other = (Author) object;
if ((this.Author_Id == null && other.Author_Id != null) || (this.Author_Id != null && !this.Author_Id.equals(other.Author_Id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "entity.Author[Author_Id=" + Author_Id + "]";
}
-----------------------
In this example we have a uni-directional many to many relation, this mean that we can have the list of author that wrote a particular book but not vice versa.(w cannot have the list of books written by this author). Note that if you want to do this it is enough to add in Author a list with the following annotation:
@ManyToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER, mappedBy = "authorList")
private List<Book> bookList;
Of course authorList is the list of author in the Book bean and, for sure we have to add its proper getter and setter.
Once done this,our many to many relation is ready to work.
Let however analyze a bit better what is highlighted in the Book Bean.
@JoinTable(name = "BOOK_AUTHOR", joinColumns = {
@JoinColumn(name = "Book_Id", referencedColumnName = "Book_Id")}, inverseJoinColumns = {
@JoinColumn(name = "Author_Id", referencedColumnName = "Author_Id")})
@ManyToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
private List<Author> authorList;
First of all, BOOK_AUTHOR is a small table that contains only the Book_Id and the Author_Id. This table is not mapped into an entity and is only a DBTable that we can create just by using the code posted on the previous post named :Let hibernate create DB tables.
As always we have to specify hibernate that the relation is a many-to-many that needs a cascade all relation and that when we ask for a book, it has to load directly also its related authors.
Without losing in generality let us assume that we have a relation Book - Authors.
As we can imagine a Book could have more than one author and an Author could have written more then one book.
We want to model two EJBs in a way that when we want to store a book into our DBs, automatically the system saves (or merge Depend whether the author is already present in the DB) the authors.
As clarification let me put the two EJBs
The first piece of code is the Book Entity
-----------------------
public class Book implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "Book_Id")
private Integer Book_Id;
@Basic(optional = false)
@Column(name = "Title")
private String title;
@Basic(optional = false)
@Column(name = "Pub_Date")
private String pubDate;
@Basic(optional = false)
@Column(name = "Price")
private double price;
@Basic(optional = false)
@Column(name = "Quantity")
private int quantity;
@Basic(optional = false)
@Column(name = "Deleted")
private boolean deleted;
@JoinTable(name = "BOOK_AUTHOR", joinColumns = {
@JoinColumn(name = "Book_Id", referencedColumnName = "Book_Id")}, inverseJoinColumns = {
@JoinColumn(name = "Author_Id", referencedColumnName = "Author_Id")})
@ManyToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
private List<Author> authorList;
public Book() {
}
public Book(Integer Book_Id) {
this.Book_Id = Book_Id;
}
public Book(Integer Book_Id, String title, String pubDate, double price, int quantity, boolean deleted) {
this.Book_Id = Book_Id;
this.title = title;
this.pubDate = pubDate;
this.price = price;
this.quantity = quantity;
this.deleted = deleted;
}
public Integer getBook_Id() {
return Book_Id;
}
public void setBook_Id(Integer Book_Id) {
this.Book_Id = Book_Id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPubDate() {
return pubDate;
}
public void setPubDate(String pubDate) {
this.pubDate = pubDate;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public boolean getDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
@Override
public int hashCode() {
int hash = 0;
hash += (Book_Id != null ? Book_Id.hashCode() : 0);
return hash;
}
public List<Author> getAuthorList() {
return authorList;
}
public void setAuthorList(List<Author> authorList) {
this.authorList = authorList;
}
@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.Book_Id == null && other.Book_Id != null) || (this.Book_Id != null && !this.Book_Id.equals(other.Book_Id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "entity.Book[Book_Id=" + Book_Id + "]";
}
}
-----------------------
And the second is the Author entity
-----------------------
public class Author implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "Author_Id")
private Integer Author_Id;
@Basic(optional = false)
@Column(name = "Name")
private String name;
@Basic(optional = false)
@Column(name = "Surname")
private String surname;
@Basic(optional = false)
@Column(name = "Email")
private String email;
@Basic(optional = false)
@Column(name = "Deleted")
private boolean deleted;
public Author() {
}
public Author(Integer Author_Id) {
this.Author_Id = Author_Id;
}
public Author(Integer Author_Id, String name, String surname, String email, boolean deleted) {
this.Author_Id = Author_Id;
this.name = name;
this.surname = surname;
this.email = email;
this.deleted = deleted;
}
public Integer getAuthorId() {
return Author_Id;
}
public void setAuthorId(Integer Author_Id) {
this.Author_Id = Author_Id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public boolean getDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
@Override
public int hashCode() {
int hash = 0;
hash += (Author_Id != null ? Author_Id.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 Author)) {
return false;
}
Author other = (Author) object;
if ((this.Author_Id == null && other.Author_Id != null) || (this.Author_Id != null && !this.Author_Id.equals(other.Author_Id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "entity.Author[Author_Id=" + Author_Id + "]";
}
-----------------------
In this example we have a uni-directional many to many relation, this mean that we can have the list of author that wrote a particular book but not vice versa.(w cannot have the list of books written by this author). Note that if you want to do this it is enough to add in Author a list with the following annotation:
@ManyToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER, mappedBy = "authorList")
private List<Book> bookList;
Of course authorList is the list of author in the Book bean and, for sure we have to add its proper getter and setter.
Once done this,our many to many relation is ready to work.
Let however analyze a bit better what is highlighted in the Book Bean.
@JoinTable(name = "BOOK_AUTHOR", joinColumns = {
@JoinColumn(name = "Book_Id", referencedColumnName = "Book_Id")}, inverseJoinColumns = {
@JoinColumn(name = "Author_Id", referencedColumnName = "Author_Id")})
@ManyToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
private List<Author> authorList;
First of all, BOOK_AUTHOR is a small table that contains only the Book_Id and the Author_Id. This table is not mapped into an entity and is only a DBTable that we can create just by using the code posted on the previous post named :Let hibernate create DB tables.
As always we have to specify hibernate that the relation is a many-to-many that needs a cascade all relation and that when we ask for a book, it has to load directly also its related authors.
Thursday, February 10, 2011
LATEX: FootNote with figure
Some days ago I had to write a paper in latex,
during this work I found a problem with the footnote of a figure. After some time I found this solution for this problem
...LATEX TEXT...
\begin{figure}
\centering
\epsfig{file=images/Image, height=130px, width=230px}
\caption[view-based]{A view-based integration system. \footnotemark}
\end{figure}
\end{description}
\footnotetext{http://en.wikipedia.org/wiki/File:Dataintegration.png}
...LATEX TEXT...
It is important to write the footnotetext before a new footnote is defined.
footnotemark is the "marker" for the footnote we are going to add immediately after.
during this work I found a problem with the footnote of a figure. After some time I found this solution for this problem
...LATEX TEXT...
\begin{figure}
\centering
\epsfig{file=images/Image, height=130px, width=230px}
\caption[view-based]{A view-based integration system. \footnotemark}
\end{figure}
\end{description}
\footnotetext{http://en.wikipedia.org/wiki/File:Dataintegration.png}
...LATEX TEXT...
It is important to write the footnotetext before a new footnote is defined.
footnotemark is the "marker" for the footnote we are going to add immediately after.
Subscribe to:
Comments (Atom)