R Diaz

Greenhorn
+ Follow
since Jun 24, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by R Diaz

Hi Mr. Srinivas,

Hope that all is well.

I have an issue with Hibernate Mappings. They seem to work well when mapping two related objects that have
composite id's, as long as the mapping does not involve id's in the two objects.

I can map an order to many requests by having the request as an attribute List in the order class. Then in the
getter for the List of requests I can have the following annotation:



In the request class I can have an attribute of the order class as:



and in the setter for that attribute the annotation @ManyToOne with the appropriate column mappings. This successfully
completes the mapping between the two classes.

However, if the two model classes have each a composite primary key, and the column in common between these
two classes is part of each class primary key, then I get an error trying to establish a relationship as described above.

The error that I get is: "No column specified in relationship", even though the column was specified.

The way I tried to establish the relationship was:

- In the invoice class I have a List of type details as: List<Details> details;

- Just above the getter for the above list, I have the annotation: @OneToMany (mappedBy = "invoice")

- In the details class I have an attribute of type invoice as: Invoice invoice;

- Just above the getter for the above invoice attribute I have an @ManyToOne annotation, then I have
an @MapsId("invoiceId") in the next line, and then an @JoinColumns with the name="invoiceCode"
specified.

Everything seems to follow the first example blueprint, the only difference is that the column is in both
models composite primary keys in the second one.

Any thoughts, suggestions, or answers are greatly appreciated.

Have a great day.

Kind regards,

Rudi


Hi Mr. Srinivas,

Hope that all is well.

I have a question regarding Hibernate using aliases. I found a problem when trying to use a hash map
to specify an alias that has more than two levels.

For example, if I have a composite id in an object as id of that class type. Then definining the alias is ok as:





However, I haven't found a way to make things work if if the id has itself an id or an element that is composite
and defined in a class.

In other words, the alias seems to work when there are three levels deep since it allows us to combine two of
those levels, and just have one dot which seems to be what Hibernate tolerates. If we are dealing with more than
three levels, then we seem to be limited since we can only combine two levels and have one dot.

Could you share some light in how to deal with this situation? Thanks.

Have a great day.

Best regards,

Rudi



Hi,

Thanks for the reply.

Yes. I try following that information, but got many errors.

It's not a step by step guide. Also, they don't go over the changes and where.
In addition, one can't make a new guess account, post anything, or email to anyone
there. I tried to email to Rafael, but got no answer.

Thanks.


12 years ago
Hi Everyone,

I'm trying to configure JForum - http://jforum.net/ - to work with Oracle.

Does anyone know the steps and right values to configure it?

Have a nice day. Thanks in advance for the help.

Best regards,

Rudi


12 years ago
Hi,

What are the specific steps to migrate an application using Spring 2.0 or 2.5 to Spring 3.0?

Thank you.

[edited to use a meaningful subject line - was "Spring 3 Book Question 2 ']
12 years ago
Hi everyone,

Hope that all is well.

I'm having trouble trying to show a pulldown with data in Struts 1.x.

I have the following code using iterate that shows the data in separate rows and works fine:



Now, I want to show one of those items, let's say the author values as a pulldown.

So I tried the following code:



Since I'm using the same collection as the iterate above, I thought that it should work
fine. Instead is giving me an error: "No getter method available for property bookListForm for bean under name books."

Anyway, I think it has to do with me not setting up the html:select right. I'm a
newbie.

Can someone please help?

Thank you,

Ru


12 years ago
Hi everyone,

I was trying to find the examples for the J2EE Tutorial for Sun One.

The link from the Tutorial is: http://java.sun.com/j2ee/1.3/download.html#tutorial

There I select the 1.3 tutorial and end up in the Sun Website to download:

https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=7872-j2ee-1.3-tutorial-oth-JPR@CDS-CDS_Developer

and there I'm trying to download the j2ee-1_3-doc-tutorial-draft5.zip file.

However, I get an error "maximum number of retries exceeded" when downloading
with the Sun Manager. It seems that the file might not be in the link that this download
points to.

Does anyone have this file or know where I can get it? Thanks.

I'm interested in the iteration part among other examples.

Have a great day. Thanks in advance.

Regards,

Ru


12 years ago
Hi Ernest,

Thanks. Yes.

I was wondering if JForum allows for using a subset of categories (or forums, like a hierarchy).
Hidding some forums or categories from users depending on their roles.

I'll download it and give it a try.

Thanks,

Rudi



13 years ago
Hi Dan,

Thanks for the links. I appreciate it.

Jt Portal seems good for developing applications from scratch. We already have an application done.

Now we're just trying to add "Forum" functionality to an existing site.

So we're trying to find a "Forum software" that we can set in the project and that will allow us to have
a forum for clients (users) of this application.

The most important feature that we're looking for is to create a Forum Hierarchy and rights.

Kind of the way the forums are listed here at Java Ranch.

However, we want to divide the forum into "categories". The "corporate" users will see all categories.
The rest will see only "categories" applicable to the area in which they belong and their role.

We don't want to show all the categories for everyone except the highest level of users "corporate".
Also, we want this "Forum" software to be something that we can use in any other application, and then
just set whatever "categories" the users should be able to use. So we can maintain sort of a company
wide list of categories in a Forum system that can be used by the whole company.

Sounds ambitious? Maybe.

Thanks,

Rudi


13 years ago
Hi Everyone,

Hope that all is well.

I was told to investigate Forum software that will enable us to obviously setup a Forum for our company and a
few of it's clients.

So far I've been looking at JForum http://www.jforum.net and a few others.

The main requirement is that it should have some sort of "Forum Hierarchy" in which users can see a certain list
of forums available based on their roles or who they belong to. Clients can only see certain forums, certain executives
from the main company can see all the forums, and so on.

Another requirement is that is a J2EE complient enterprise solution. Additionally, it should have security and roles
functionality.

Could anyone here share their experience and suggest a good software to setup a forum that meets the requirements
above?

Thanks in advance for your help.

Best regards,

Rudi


13 years ago
Hi Everyone,

I'm new working with Struts and I get an error "No getter method for property author."

Sorry to post the code, but I'm hoping that someone could tell me what
I'm doing wrong. I haven't been able to figure this out and the solutions
in another thread about this don't work.

The code is as follows:


-- Book.java:

package com.mycompany;

public class Book implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private long id;
private String title;
private String author;
private char available;

public Book() {}

public Book(long id, String title, String author, char available) {
this.id = id;
this.title = title;
this.author = author;
this.available = available;
}

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;
}

public char getAvailable() {
return available;
}

public void setAvailable(char available) {
this.available = available;
}
}

============================================================

-- BookListForm.java

package com.mycompany.struts.form;

import java.util.ArrayList;
import java.util.Collection;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

/**
* MyEclipse Struts
* Creation date: 06-24-2008
*
* XDoclet definition:
* @struts.form name="bookListForm"
*/

public class BookListForm extends ActionForm {

private Collection books;

/**
* @return the books
*/
public Collection getBooks() {
return books;
}

/**
* @param books the books to set
*/
public void setBooks(Collection books) {
this.books = books;
}

public void reset(ActionMapping mapping, HttpServletRequest request) {
books = new ArrayList();
}

}

============================================================

-- BookListAction.java


package com.mycompany.struts.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.mycompany.form.BookListForm;
import com.mycompany.hibernate.*;
import org.hibernate.SessionFactory;
import org.hibernate.Session;
import java.util.Collection;

/**
* MyEclipse Struts
* Creation date: 06-24-2008
*
* XDoclet definition:
* @struts.action path="/bookList" name="bookListForm" input="/jsp/bookList.jsp" scope="request" validate="true"
*/

public class BookListAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse
response) {

BookListForm bookListForm = (BookListForm) form;

SessionFactory factory = null;
Session session = null;
Collection books = null;

try {

factory = HibernateUtil.getSessionFactory();

session = (Session) factory.openSession();

books = session.createQuery("select id, title, author, available from Book t ").list();

bookListForm.setBooks(books);

} finally {
session.close();
}

return mapping.findForward("showList");

}
}

============================================================

-- bookList.jsp

<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>

<html>
<head>
<title>Show book list</title>
</head>
<body>
<table border="1">
<tbody>
<%-- set the header --%>
<tr>
<td>Author</td>
<td>Book name</td>
<td>Available</td>
<td> </td>
<td> </td>
</tr>
<%-- check if book exists and display message or iterate over books --%>
<logic:empty name="bookListForm" property="books">
<tr>
<td colspan="5">No books available</td>
</tr>
</logic:empty>
<logic:notEmpty name="bookListForm" property="books">
<logic:iterate name="bookListForm" property="books" id="book">
<tr>
<%-- print out the book information --%>
<td><bean:write name="book" property="author" /></td>
<td><bean:write name="book" property="title" /></td>
<td><html:checkbox disabled="true" name="book" property="available" />
</td>

<%-- print out the edit and delete link for each book --%>
<td><html:link action="bookEdit.do?do=editBook" paramName="book"
paramProperty="id" paramId="id">Edit</html:link></td>
<td><html:link action="bookEdit.do?do=deleteBook" paramName="book"
paramProperty="id" paramId="id">Delete</html:link></td>
</tr>
</logic:iterate>
</logic:notEmpty>

<%-- print out the add link --%>
<tr>
<td colspan="5"><html:link action="bookEdit.do?do=addBook">Add a new book</html:link>
</td>
</tr>

<%-- end interate --%>

</tbody>
</table>
</body>
</html>

============================================================

Sorry for posting the code. Thanks in advance for any help.

Best regards,

Rudi
14 years ago
Hi Everyone,

I'm new working with Struts and also got this "No getter method for property error." Sorry to post the code, but I'm hoping that someone
could tell me what I'm doing wrong. I haven't been able to figure this out and it's not like what was previously mentioned.

The code is as follows:


-- Book.java:

package com.mycompany;

public class Book implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private long id;
private String title;
private String author;
private char available;

public Book() {}

public Book(long id, String title, String author, char available) {
this.id = id;
this.title = title;
this.author = author;
this.available = available;
}

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;
}

public char getAvailable() {
return available;
}

public void setAvailable(char available) {
this.available = available;
}
}

============================================================

-- BookListForm.java

package com.mycompany.struts.form;

import java.util.ArrayList;
import java.util.Collection;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

/**
* MyEclipse Struts
* Creation date: 06-24-2008
*
* XDoclet definition:
* @struts.form name="bookListForm"
*/

public class BookListForm extends ActionForm {

private Collection books;

/**
* @return the books
*/
public Collection getBooks() {
return books;
}

/**
* @param books the books to set
*/
public void setBooks(Collection books) {
this.books = books;
}

public void reset(ActionMapping mapping, HttpServletRequest request) {
books = new ArrayList();
}

}

============================================================

-- BookListAction.java


package com.mycompany.struts.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.mycompany.form.BookListForm;
import com.mycompany.hibernate.*;
import org.hibernate.SessionFactory;
import org.hibernate.Session;
import java.util.Collection;

/**
* MyEclipse Struts
* Creation date: 06-24-2008
*
* XDoclet definition:
* @struts.action path="/bookList" name="bookListForm" input="/jsp/bookList.jsp" scope="request" validate="true"
*/

public class BookListAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse
response) {

BookListForm bookListForm = (BookListForm) form;

SessionFactory factory = null;
Session session = null;
Collection books = null;

try {

factory = HibernateUtil.getSessionFactory();

session = (Session) factory.openSession();

books = session.createQuery("select id, title, author, available from Book t ").list();

bookListForm.setBooks(books);

} finally {
session.close();
}

return mapping.findForward("showList");

}
}

============================================================

-- bookList.jsp

<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>

<html>
<head>
<title>Show book list</title>
</head>
<body>
<table border="1">
<tbody>
<%-- set the header --%>
<tr>
<td>Author</td>
<td>Book name</td>
<td>Available</td>
<td> </td>
<td> </td>
</tr>
<%-- check if book exists and display message or iterate over books --%>
<logic:empty name="bookListForm" property="books">
<tr>
<td colspan="5">No books available</td>
</tr>
</logic:empty>
<logic:notEmpty name="bookListForm" property="books">
<logic:iterate name="bookListForm" property="books" id="book">
<tr>
<%-- print out the book information --%>
<td><bean:write name="book" property="author" /></td>
<td><bean:write name="book" property="title" /></td>
<td><html:checkbox disabled="true" name="book" property="available" />
</td>

<%-- print out the edit and delete link for each book --%>
<td><html:link action="bookEdit.do?do=editBook" paramName="book"
paramProperty="id" paramId="id">Edit</html:link></td>
<td><html:link action="bookEdit.do?do=deleteBook" paramName="book"
paramProperty="id" paramId="id">Delete</html:link></td>
</tr>
</logic:iterate>
</logic:notEmpty>

<%-- print out the add link --%>
<tr>
<td colspan="5"><html:link action="bookEdit.do?do=addBook">Add a new book</html:link>
</td>
</tr>

<%-- end interate --%>

</tbody>
</table>
</body>
</html>

============================================================

Sorry for posting the code. Thanks in advance for any help.

Best regards,

Rudi
14 years ago