You need an object constructor for the view. The table doesn't contain two columns in each row. It contains an object that has two values. So:
CREATE OR REPLACE VIEW MT_TIMESTAMP_ERROR_VIEW
OF MT_TIMESTAMP_ERROR_TYPE
WITH OBJECT IDENTIFIER(ID)
AS
(
select MT_TIMESTAMP_ERROR_TYPE(ecid, CAST(startdate as TIMESTAMP))
from MT_TIMESTAMP_ERROR_TABLE
);
Here is a SQL Fiddle.
Alternatively, if you want to extract the two fields from the object, then don't declare the view to return an object:
CREATE OR REPLACE VIEW MT_TIMESTAMP_ERROR_VIEW
AS
(
select t.ecid, t.startdate
from MT_TIMESTAMP_ERROR_TABLE t
);
PS. I have no idea why Oracle is giving such a confusing error message. It really should be more like "inconsistent datatypes: expected MT_TIMESTAMP_ERROR_TYPE got TIMESTAMP". Presumably, the error handling system is getting confused on the different levels of types.
If your sole reason is to get rid of the .xhtml
extension, then there are various ways depending on the JSF version you're using.
JSF 2.3+
JSF 2.3 offers a new API to collect all views: the ViewHandler#getViews()
. Combine this with ServletRegistration#addMapping()
in a ServletContextListener
as below.
@FacesConfig
@WebListener
public class ApplicationConfig implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent event) {
addExtensionLessMappings(event.getServletContext(), FacesContext.getCurrentInstance());
}
private void addExtensionLessMappings(ServletContext servletContext, FacesContext facesContext) {
servletContext
.getServletRegistrations().values().stream()
.filter(servlet -> servlet.getClassName().equals(FacesServlet.class.getName()))
.findAny()
.ifPresent(facesServlet -> facesContext
.getApplication()
.getViewHandler()
.getViews(facesContext, "/", ViewVisitOption.RETURN_AS_MINIMAL_IMPLICIT_OUTCOME)
.forEach(view -> facesServlet.addMapping(view))
);
}
}
Effectively, this is an oneliner. Source: Arjan Tijms' Blog and The Definitive Guide to JSF.
If you're using MyFaces as JSF 2.3 implementation, then this can be transparently activated by solely the following web.xml
context parameter:
<context-param>
<param-name>org.apache.myfaces.AUTOMATIC_EXTENSIONLESS_MAPPING</param-name>
<param-value>true</param-value>
</context-param>
Mojarra does not have an equivalent yet.
JSF 2.2-
Use OmniFaces FacesViews. It offers a zero-configuration way to achieve that by placing the view files in /WEB-INF/faces-views/
folder. Otherwise, if you intend to not modify your project structure and want to keep your view files at the usual place and still benefit of extensionless URLs, then it's a matter of adding the following context parameter:
<context-param>
<param-name>org.omnifaces.FACES_VIEWS_SCAN_PATHS</param-name>
<param-value>/*.xhtml</param-value>
</context-param>
In case you don't want to use OmniFaces, but rather want to homegrow your own, just look at source code of OmniFaces. It's open source under Apache 2.0 License. It's only not an oneliner.
Best Answer
I assume SQL Developer makes an implict
ALTER SESSION SET time_zone=...
when you open a new connection.I see several solutions:
TZ
on client hostDatabase Trigger:
END;