Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
- Using stateless beans generated by seam in standalon

- Using stateless beans generated by seam in standalon

2007-07-12       - By JbossDing

 Back
I am pretty new to seam framework but have 3 years experience with previous
versions of EJB. Our project is using seam to generate codes for a web
application to access backend database. It works pretty good. However, I have
the need to access the same database in standalone Java applications outside of
Jboss virtual machine. When I looked at the seam-generated code, I am lost and
need help.

First how to look up session bean in my Java application? I can not find the
ejb-jar.xml so I do not know what is the jndi name used for the generated beans
. Second, I do not know how to call those generated beans. For example, I have a
table called Host in a test database, the table is simple with id, hostname,
and connect_time. Use seam setup, seam new-project, seam generate-entities, and
seam explode, seam framework did almost everything for me. It generates two
java files in the action folder. Here is the code: in HostList.java

@(protected)("hostList")
 | public class HostList extends EntityQuery {
 |
 |   private static final String[] RESTRICTIONS = {"lower(host.hostname) like
concat(lower(#{hostList.host.hostname}),'%')",};
 |
 |   private Host host = new Host();
 |
 |   @(protected)
 |   public String getEjbql() {
 |     return "select host from Host host";
 |   }
 |
 |   @(protected)
 |   public Integer getMaxResults() {
 |     return 25;
 |   }
 |
 |   public Host getHost() {
 |     return host;
 |   }
 |
 |   @(protected)
 |   public List<String> getRestrictions() {
 |     return Arrays.asList(RESTRICTIONS);
 |   }
 |
 | }

in HostHome.java

@(protected)("hostHome")
 | public class HostHome extends EntityHome<Host> {
 |
 |   public void setHostId(Integer id) {
 |     setId(id);
 |   }
 |
 |   public Integer getHostId() {
 |     return (Integer) getId();
 |   }
 |
 |   @(protected)
 |   protected Host createInstance() {
 |     Host host = new Host();
 |     return host;
 |   }
 |
 |   public void wire() {
 |   }
 |
 |   public boolean isWired() {
 |     return true;
 |   }
 |
 |   public Host getDefinedInstance() {
 |     return isIdDefined() ? getInstance() : null;
 |   }
 |
 | }

By looking at the code, I am lost at how I should call the bean to make select,
update, delete, and insert operations.

Would anyone give me some help or point me to some documents or tutorials?
Thanks a lot.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic
&p=4063530#4063530

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode
=reply&p=4063530
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user

©2008 junlu.com - Jax Systems, LLC, U.S.A.