Win a copy of Learn Java with Math: Using Fun Projects and Games this week in the Beginning Java forum!

Mathias Berg

Greenhorn
+ Follow
since Oct 03, 2007
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 Mathias Berg

Please provide the error log. Also just to clear out. Are you accesing a .jsf url or .jsp. (Your faces servlet checks on all *jsf url access.)

<a href="index.jsf">link</a>
12 years ago
JSF
As i see it, components is finished utils to use. Like Selects, radio, checkboxes, fileupload, menu navigations, tab navigations, Result listing in tabels (myfaces/tomahawk has a good dataTable component for this). And so on...

These components write out finished html code. So in your jsp page you only need to include these component tags.
Well you get more info by reading some tutorials about JSF.

Some links:
http://java.sun.com/javaee/javaserverfaces/index.jsp
http://www.coreservlets.com/JSF-Tutorial/
http://wiki.apache.org/myfaces/
http://www.jsfcentral.com/

Regards, Mathias.
12 years ago
JSF
Response to myself

My inparam to the SP wich is a timestamp. If its null then i get this error

PLS-00306: wrong number or types of arguments in call to 'SELECTALLCASES'

But if a replace the null with a emtpy string "" then it doesnt throw a exception.
So it seems my Hibernate query skips the inpara if its null (This only happens for Timestamps though, for varchar2 it works fine with null)

Any clues, would be apreciated?
Hi i wonder if i could get some help regarding a small but so irretation thing.

Is there a problem of using Timestamp as null in a call to a stored procedure, by using Hibernate and Native SQL to to the call.
(im using this as an example, http://www.hibernate.org/hib_docs/v3/reference/en/pdf/hibernate_reference.pdf -> 16.2.2. Using stored procedures for querying)

Im using Spring 2.3, Hibernate 3, Oracle 10g database.

My DAO look like this.
-----------------------------------------

...
List<TestSP> testSP = getHibernateTemplate().findByNamedQueryAndNamedParam
("selectAllCases_sp", new String[]{"id", "date_from"}
, new Object[]{"73",null}
);

....

My Hibernate stored procedure mapping file.
-----------------------------------------

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>

<class name="TestSP" mutable="false">
<id name="Id" column="id" type="string" >
<generator class="assigned"/>
</id>
<property name="type" column="type"/>
</class>

<sql-query name="selectAllCases_sp" callable="true">
<return alias="testSP" class="TestSP">
<return-property name="Id" column="id"/>
<return-property name="type" column="type"/>

</return>
{ ? = call selectAllCases(:id, ate_from) }
</sql-query>
</hibernate-mapping>


My Exception is this
-------------------------------------------------------
....
2007-11-13 16:55:50,522 DEBUG org.hibernate.jdbc.AbstractBatcher(line:393) - { ? = call selectAllCases(?, ?) }
2007-11-13 16:55:50,569 WARN org.hibernate.util.JDBCExceptionReporter(line:77) - SQL Error: 6550, SQLState: 65000
2007-11-13 16:55:50,569 ERROR org.hibernate.util.JDBCExceptionReporter(line:78) - ORA-06550: line 1, column 13:
PLS-00306: wrong number or types of arguments in call to 'SELECTALLCASES'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

2007-11-13 16:55:50,569 ERROR CaseDaoHibernate(line:86) - error
org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
Caused by:
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2214)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
at org.hibernate.loader.Loader.list(Loader.java:2090)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150)
at org.springframework.orm.hibernate3.HibernateTemplate$33.doInHibernate(HibernateTemplate.java:940)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:369)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNamedParam(HibernateTemplate.java:931)
at CaseDaoHibernate.getTestSP(CaseDaoHibernate.java:80)
at CaseDaoTest.testCaseSearch(CaseDaoTest.java:85)
.....
Hi all, im having problem with JSF code in my sitemesh decorator files. i get this error if im putting in some JSF code, like <f:view> ... </f:view> in my default decorator file. It works fine in my other JSP files (Those that displays through the <decorator:body/> tag)

------------------------------------------------------------
javax.faces.FacesException: Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml configuration fileand if you are accessing your jsf-pages through the correct mapping. E.g.: if your FacesServlet is mapped to *.jsf (with the -element), you need to access your pages as 'sample.jsf'. If you tried to access 'sample.jsp', you'd get this error-message.
at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:926)
at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:313)
at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:73)
at org.apache.jsp.decorators.default_jsp._jspx_meth_f_005fview_005f0(default_jsp.java:341)
at org.apache.jsp.decorators.default_jsp._jspService(default_jsp.java:167)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(Servlet.java:803)

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

Anyone got this problem, solved it also maybe :-)

My env is:

Tomcat 5.5 / Servlet 2.4.
myfaces, 1.1.5
sitemesh, 2.2.1
12 years ago
JSF