EJB-QL and Date

Hi!
I read in several books, datatype Date is not supported in EJB-QL.
I tried what's happening when using datatype java.util.Date in CMP Entity-Beans implementing a person with birthday and I could use queries like "findByBirthday", "findWhereBirthdayBefore", ...
So what exactly does "not supported" for Datatype "Date" mean? What are the not supported queries or am I automatically using application server dependant stuff then?
Thanks for your answer!
Martin

I use java.sql.Date and java.sqlTimestamp in my EJB-QL queries
This is example for java.sql.Timestamp
         <query>
            <query-method>
                <method-name>findByPeriod</method-name>
                <method-params>
                    <method-param>java.sql.Timestamp</method-param>
                    <method-param>java.sql.Timestamp</method-param>
                </method-params>
            </query-method>
            <ejb-ql><![CDATA[
                SELECT OBJECT(a)
                FROM action a
                WHERE a.moment > ?1 and a.moment < ?2
                ]]>
            </ejb-ql>
         </query>

Similar Messages

  • EJB-QL and date/time types

    Hi,
    as far as I understand, EJB-QL does not support date/time values.
    Does anybody know how to work around this limitation?
    Using long values containing milliseconds is not an alternative, because the database stores
    date/time values.
    I need to compare these date/time values to input parameters in finder methods.
    Suggestions?
    Bye the way, is there any reason for this limitation in EJB-QL, or did they simply forget to include
    date/time types to the spec?
    Greetings
    Christian

    Greetings,
    Hi,
    as far as I understand, EJB-QL does not support
    date/time values. Actually, it does - EJB QL supports all types supported by a bean's abstract schema (IOW: available types for CMP/CMR fields). However, therein also lies the crutch - EJB QL is for querying beans, not the resource to which they map (EJB QL's similarity to SQL is purely for convenience; an Entity Bean, it should be remembered, may represent entities in any persistent store, not just RDBMSes). Therefore, you should be thinking in terms of Java types, not SQL ones... The specification, however, does place "restrictions" (ie. minimally required [vendor] support), on their use which should be limited to long millisecond values (by which a Date object performs an equals comparison... ;).
    Does anybody know how to work around this limitation?Depends on what you're attempting. If you're using a Date as an argument to a finder, eg:
    findByDateInRange( java.util.Date start, java.util.Date end )then this shouldn't pose a problem where your EJB QL would look like:
    SELECT OBJECT(a) FROM MyBeanSchema AS a WHERE a.myDate BETWEEN ?1 AND ?2Presuming the bean MyBean contains a CMP field of type java.util.Date called 'myDate'. If, however, you must use a literal date then you will have to use a long literal unless your vendor supports otherwise. However, it might be worth noting that EJB QL must still be mapped to the underlying resource QL (eg. SQL), and so a more intelligble value (one that meets the resource's format requirements ;), could be used in the actual rQL statement.
    Using long values containing milliseconds is not an
    alternative, because the database stores
    date/time values.I'm guessing you mean here something like "04/23/2002" and "13:13:35", etc. This, however, is not how the database actually stores the data - input/output formats such as these are supported for the convenience of us 'nuerically-challenged' humans (similar to internet hostnames vs. TCP/IP addresses ;) - nor do Java Date/Calendar/Timestamp types store them this way.
    I need to compare these date/time values to input
    parameters in finder methods.
    Suggestions?Ah, yes. Well then... refer back to the above. :)
    Bye the way, is there any reason for this limitation
    in EJB-QL, or did they simply forget to include
    date/time types to the spec?The EJB QL does not explicitly support any specific types beyond those "supported by an EJB's abstract schema", which is pretty much any Java type that can represent a compatible resource type. The reason for the noted "restriction" on date/time types, however, is (likely) due to the way the associated Java classes (not to mention the back-end resource), handle/represent these data internally and this gives the vendor an easily achievable minimal level of compliance for supporting these types.
    I hope this helps.
    ChristianRegards,
    Tony "Vee Schade" Cook

  • Problems with OC4J EJB deployment and the data-sources.xml file

    I am running 2 Windows 2000 Machines one with the 8.1.7 database another with iAS 1.0.2.2.1 and OC4J.
    I am trying to deploy a 3rd party EJB-based application whic seems to have deployed successfully except when I try to test the EJB deployment via a jsp it can't connect to the database, giving the error:
    1/16/02 4:52 PM VerySimple: Servlet error
    java.lang.NoClassDefFoundError: com.netexp.user.UserManagerHome
    at com.netexp.beans.BeanHelper.class$(Unknown Source)
    at com.netexp.beans.BeanHelper.getUserManagerBean(Unknown Source)
    at /very_simple.jsp._jspService(/very_simple.jsp.java:48) (JSP page line 27)
    at com.orionserver[Oracle9iAS (1.0.2.2.1) Containers for J2EE].http.OrionHttpJspPage.service(OrionHttpJspPage.java:54)
    at com.evermind[Oracle9iAS (1.0.2.2.1) Containers for J2EE].server.http.HttpApplication.serviceJSP(HttpApplication.java:5459)
    at com.evermind[Oracle9iAS (1.0.2.2.1) Containers for J2EE].server.http.JSPServlet.service(JSPServlet.java:31)
    at com.evermind[Oracle9iAS (1.0.2.2.1) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:508)
    at com.evermind[Oracle9iAS (1.0.2.2.1) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:177)
    at com.evermind[Oracle9iAS (1.0.2.2.1) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:576)
    at com.evermind[Oracle9iAS (1.0.2.2.1) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:189)
    at com.evermind[Oracle9iAS (1.0.2.2.1) Containers for J2EE].util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    I try to update the file using the installdatasource switch thus:
    C:\Oracle\iSuites\j2ee\home>java -jar admin.jar ormi://localhost admin adm_pwd -application apptricityII -installDataSource -jar %ORACLE_HOME%\jdbc\lib\classes12.zip -url jdbc:oracle:thin:@db_host.unitas.com:1521:db_name -connectionDriver oracle.jdbc.driver.OracleDriver -location jdbc/pool/OracleDataSource -username scott -password tiger
    And get the following error:
    Exception passing by from remote server: java.lang.InstantiationException: No class specified for jdbc/pool/OracleDataSource
    java.lang.InstantiationException: No class specified for jdbc/pool/OracleDataSource
    <<no stack trace available>>
    Error adding source: No class specified for jdbc/pool/OracleDataSource
    Please advise.
    I have followed the instructions in 'EJB Primer' and 'Using Oracle9iAS Containers for J2EE' to no avail. And I can't find any meaningfull data-sources.xml samples. I have been struggling with this for some time.
    Is there any other file, do I need to bind anything?
    I'd appreciate your assistance.
    Thank you
    Louiza

    Hi Louiza,
    Show us your web.xml and ejb-jar.xml files as well as your
    data-source.xml file.
    Thanks,
    Avi.

  • EJB-JSF Application : Data does not persist to the database

    Hi,
    I am developing a JSF - EJB application and the data that I send from JSP Page through JSF Managed Bean --> Session Bean --> Java Persistence does not persist in database.
    Here is my scenario ( Iam using JDeveloper IDE to create this application) -
    SCENARIO START
    The scenario consists of two web pages, one enlisting all the users stored in the database, the other contains a form for adding a user
    1.) INDEX.JSP
    2.) ADDUSER.JSP
    Step 1: Create the USERS Table in database
    CREATE TABLE users
    user_id serial,
    username varchar(255) NOT NULL,
    first_name varchar(255),
    last_name varchar(255),
    password char(64) NOT NULL,
    CONSTRAINT pk_users PRIMARY KEY (user_id)
    Step 2: Add Database Connection To JDeveloper
    Go to Database Connection Navigator and create a New Database Connection using the Wizard
    Step 3: Create a New Application in JDeveloper and select JSF, EJB from Application Template
    Step 4: ENTITY BEAN - In the EJB Node Right Click and Select EJB � New Entites from Table (JPA/EJB3.0)
    Use The Wizard and create Entity Bean from Users Table which creates an Entity Bea POJO file as follows �
    User.java -
    package lux.domain;
    import java.io.Serializable;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.NamedQuery;
    import javax.persistence.SequenceGenerator;
    import javax.persistence.Table;
    @Entity
    @NamedQuery(name = "User.findAll", query = "select o from User o")
    @Table(name = "USERS")
    public class User implements Serializable {
    @Column(name="FIRST_NAME")
    private String firstName;
    @Column(name="LAST_NAME")
    private String lastName;
    @Column(nullable = false)
    private String password;
    @Column(nullable = false)
    private String username;
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="users_seq_generator")
    @SequenceGenerator(name="users_seq_generator", sequenceName="users_user_id_seq")
    @Column(name="USER_ID", nullable = false)
    private Long userId;
    public User() {
    public String getFirstName() {
    return firstName;
    public void setFirstName(String firstName) {
    this.firstName = firstName;
    public String getLastName() {
    return lastName;
    public void setLastName(String lastName) {
    this.lastName = lastName;
    public String getPassword() {
    return password;
    public void setPassword(String password) {
    this.password = password;
    public String getUsername() {
    return username;
    public void setUsername(String username) {
    this.username = username;
    public Long getUserId() {
    return userId;
    public void setUserId(Long userId) {
    this.userId = userId;
    Step 5: STATELESS SESSION BEAN - In the EJB Node Right Click and Select EJB � New Entites from Table (JPA/EJB3.0)
    Again Right Click on Model and create Session Bean from Wizard which creates two files �
    UserDAOBean.java � Stateless Session Bean
    UserDAO.java � Local Interface
    package lux.facade;
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import java.util.List;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
    import lux.domain.User;
    @Stateless(name="UserDAO")
    public class UserDAOBean implements UserDAO {
    @PersistenceContext(unitName="Model")
    private EntityManager em;
    public UserDAOBean() {
    public User getUser(int UserId) {
    User u = new User();
    u = em.find(User.class, UserId);
    return u;
    public List<User> getAllUsers() {
    Query q = em.createQuery("SELECT u FROM User u");
    List<User> users = q.getResultList();
    return users;
    public void createUser(User u) {
    String hashedPw = hashPassword(u.getPassword());
    u.setPassword(hashedPw);
    em.persist(u);
    public void updateUser(User u) {
    String hashedPw = hashPassword(u.getPassword());
    u.setPassword(hashedPw);
    em.merge(u);
    public void deleteUser(User u) {
    em.remove(u);
    private String hashPassword(String password) {
    StringBuilder sb = new StringBuilder();
    try {
    MessageDigest messageDigest = MessageDigest.getInstance("SHA");
    byte[] bs;
    bs = messageDigest.digest(password.getBytes());
    for (int i = 0; i < bs.length; i++) {
    String hexVal = Integer.toHexString(0xFF & bs);
    if (hexVal.length() == 1) {
    sb.append("0");
    sb.append(hexVal);
    } catch (NoSuchAlgorithmException ex) {
    Logger.getLogger(UserDAOBean.class.getName()).log(Level.SEVERE, null, ex);
    return sb.toString();
    Step 6: Create a Deployment file in the Model and Deploy this to a JAR file
    Step 7: Now Right Click on View/Controller Node and create a Java File �
    UserController.java -
    package lux.controllers;
    import javax.ejb.EJB;
    import javax.faces.model.DataModel;
    import javax.faces.model.ListDataModel;
    import lux.domain.User;
    import lux.facade.UserDAO;
    public class UserController {
    @EJB UserDAO userDao;
    private User user;
    private DataModel model;
    public String createUser() {
    this.user = new User();
    return "create_new_user";
    public String saveUser() {
    String r = "success";
    try {
    userDao.createUser(user);
    } catch (Exception e) {
    e.printStackTrace();
    r = "failed";
    return r;
    public DataModel getUsers() {
    model = new ListDataModel(userDao.getAllUsers());
    return model;
    public User getUser() {
    return user;
    public void setUser(User user) {
    this.user = user;
    Step 8: Configure page flow in faces-config.xml
    1. Create the JSP file adduser.jsp by right-clicking View-Controller
    node and selecting New > JSP. Use the wizard to create JSF � JSP Page, fill in
    File Name adduser.jsp, click Finish. -
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>New user</title>
    </head>
    <body>
    <f:view>
    <h:form>
    <h:messages/>
    <h:panelGrid columns="2">
    <h:outputText value="Username"/>
    <h:inputText
    id="Username"
    value="#{user.user.username}"
    required="true"/>
    <h:outputText value="First name"/>
    <h:inputText
    id="FirstName"
    value="#{user.user.firstName}" />
    <h:outputText value="Last name"/>
    <h:inputText
    id="LastName"
    value="#{user.user.lastName}" />
    <h:outputText value="Password" />
    <h:inputSecret
    id="Password"
    value="#{user.user.password}"
    required="true" />
    <h:panelGroup/>
    <h:commandButton
    action="#{user.saveUser}"
    value="Save"/>
    </h:panelGrid>
    </h:form>
    </f:view>
    </body>
    </html>
    2. Repeat the previous step for another JSP file failed.jsp.
    3. On failed.jsp add the string
    Save failed
    Next we configure the page flow.
    1. Open faces-config.xml.
    2. Create index.jsp -
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>User Listing</title>
    </head>
    <body>
    <f:view>
    <h:form>
    <h:outputText value="User Listing"/>
    <h:commandLink action="#{user.createUser}" value="Create a user"/>
    <h:dataTable value="#{user.user}"
    var="dataTableItem" border="1" cellpadding="2" cellspacing="2">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Username"/>
    </f:facet>
    <h:outputText value="#{dataTableItem.username}" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="First name"/>
    </f:facet>
    <h:outputText value="#{dataTableItem.firstName}" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Last name"/>
    </f:facet>
    <h:outputText value="#{dataTableItem.lastName}" />
    </h:column>
    </h:dataTable>
    </h:form>
    </f:view>
    </body>
    </html>
    3. Drag an arrow from index.jsp to adduser.jsp and replace the arrow�s label to create_new_user.
    4. Repeat the previous step for failed, by dragging and arrow from adduser.jsp to failed.jsp renaming the label to f
    ailed
    5. Finally repeat the step for adduser.jsp, by dragging from adduser.jsp to index.jsp renaming the label to success.
    This creates the following faces-config.xml file �
    <?xml version='1.0' encoding='UTF-8'?>
    <faces-config>
    <managed-bean>
    <managed-bean-name>user</managed-bean-name>
    <managed-bean-class>lux.controllers.UserController</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    <managed-property>
    <property-name>username</property-name>
    <value>#{username}</value>
    </managed-property>
    <managed-property>
    <property-name>firstName</property-name>
    <value>#{firstName}</value>
    </managed-property>
    <managed-property>
    <property-name>lastName</property-name>
    <value>#{lastName}</value>
    </managed-property>
    <managed-property>
    <property-name>password</property-name>
    <value>#{password}</value>
    </managed-property>
    </managed-bean>
    <navigation-rule>
    <from-view-id>/index.jsp</from-view-id>
    <navigation-case>
    <from-outcome>create_new_user</from-outcome>
    <to-view-id>/adduser.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    <navigation-rule>
    <from-view-id>/adduser.jsp</from-view-id>
    <navigation-case>
    <from-outcome>failed</from-outcome>
    <to-view-id>/failed.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
    <from-outcome>success</from-outcome>
    <to-view-id>/index.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    </faces-config>
    Step 9: Create a Deployment file in the View-Controller and Deploy this to a WAR file
    Step 10: Create a Deployment file in the View-Controller and create an EAR file and add Model�s JAR and View-Controller�s
    WAR files to it.
    Step 11: Run the JSP Files
    SCENARIO END
    Now, When I execute Index.jsp, it does not list values from database and when I click on Create User link, it takes me to adduser.jsp page. When I fill values in this page and click Save button, it takes me to Save Failed page and data does not persist to the database.
    WHAT IS WRONG OUT HERE ???

    If you set a breakpoint in your createUser method - does this code get executed?
    We have a couple of tutorials that might show you how to do this.
    EJB/JSF with ADF-binding tutorial:
    http://www.oracle.com/technology/obe/obe1013jdev/10131/ejb_and_jpa/master-detail_pagewith_ejb.htm
    EJB/JSF without ADF binding:
    http://www.oracle.com/technology/obe/JavaEE_tutorial_10131/index.htm

  • Stored procedure, EJB, JPA, and JavaServer Faces

    Hi!
    I am currently working on a Web application using EJB, JPA, and JavaServer Faces. A part of the
    business logic is already stored in the database as stored procedures, so we need to call those
    procedures (instead of named queries) through a EJB and represent the data on the web tier.
    Where can I find an extensive tutorial using this technology? There is no such tutorial in the Oracle Learning Library.
    Maybe somebody can provide a link and/or example.
    Thanks in advance for your help!

    Hi,
    http://download.oracle.com/docs/cd/B10464_05/web.904/b10313/queries.htm#1135305
    For more help, see the TopLink / JPA forum
    TopLink/JPA
    Frank

  • Where to put utility jar (used by EJB's and war)

    Hello all,
    In many cases when you create a web application including EJB's and a WAR file packaged together in an EAR file, you need some utility classes that are used in the EJB's as wel as in the servlets in the WAR. The utility classes might for example be value object classes that servlets use to exchange data with te EJB's.
    My question is: What is the best place to put the utility class files?
    There is a new article on JDC: http://developer.java.sun.com/developer/technicalArticles/J2EE/build/ that gives some tips. For example, it proposes to put the utility JAR in the EAR file and then add a "Class-Path:" entry to the MANIFEST.MF of the EJB's that use the utility classes.
    However, this approach does not work on BEA Weblogic 6.0. Weblogic's classloader just seems to ignore the "Class-Path:" in the EJB JAR's manifest.
    Any thoughts?
    regards
    Jesper

    The "CLASS-PATH" mechanism in that article is a new
    requirement in J2EE 1.3 (final draft 4). Therefore
    right now Weblogic does not support it yet. Now you
    need to put those utility classes in both the WAR (in
    WEB-INF/lib) and EJB JAR files. If you really want
    only 1 copy of the jar file deployed, you can manually
    add that jar file to weblogic server classpath in the
    start script under config/yourdomain.HI all,
    I have some Utility jar file for EJB and Web Application,
    In the second solution about one copy in weblogic,
    I tried it in the WLS60 it's ok
    But it didn't work in WLS61
    Anyone could give me any good suggestion?
    Moen

  • DataSource - difference between ejb-location and location

    Hi,
    Does anyone know difference between ejb-location and location attribute specified in datasources.xml for an emulated datasource.
    There are few connection leakage errors reported in log files though the connection and other database objects have been closed in finally block in all places.
    So just wanted to find out whether specifying the same value for location as well as ejb-location is not the root cause of connection leakage errors.
    Thanks in advance for any help.
    Regards,
    Smita

    Smita,
    Personally, I think you should make sure that all locations (in your "data-sources.xml" file) should be different -- although I can't tell you why.
    According to the documentation, the "ejb-location" uses a connection pool and I exclusively use the "ejb-location".
    Good Luck,
    Avi.

  • JDev 10.1.3 and data control

    I didn't find the data control palette in JDev 10.1.3. Does it mean data control are not yet implemented in this preview or do i something wrong ?
    Is it possible to obtain a version with data control implemented. We only use this portion of adf with ejb.

    thanks
    i'm a little bit confused by the fact that jsf in 10.1.3 preview use managed bean (instead of data control) to get/put data from the model layer.
    we are using entity bean and session facade. In 9.0.5.2 we are using dto and data control to generate our jsp.
    we are currently testing/discovering jsf and search the best way to efficiently generate our ui's
    what is right way for jsf
    a) managed bean (if it is possible with session bean)
    b) data control when/if available
    and why ?

  • WebLogic 11g EAR EJB Classpath and class loaders

    All,
    I have been having issues migrating Spring based EJB applications from OC4J to WebLogic 11g (10.3.1). I have been in communication with Oracle who has suggested a work around however I am keen to see if anyone else can suggest a solution.
    The application is dependant on stateless session EJB beans that communicate with a Spring managed service tier to perform the business logic and database access. PitchFork is used to inject the Spring managers into the EJB’s using the spring-ejb-jar.xml configuration file. Note originally I was using the SpringBeanAutowiringInterceptor however I could not get this to work. See WebLogic 11g and Spring beens injected into EJB for details.
    When the application is deployed packaging all the dependant jars within the APP-INF\lib folder I get a verity of errors from the following InvalidClassException, NoSuchMethodError, AbstractMethodError and IllegalArgumentException. I am using Spring 2.5.3 to match the supported WebLogic version. Note within the EAR application.xml the library-directory is set to APP-INF/lib. The issue appears to be Spring, PitchFork, commons-logging and aspectj libraries are being loaded form WebLogic and do not have visibility on jars within the application or have been modified when bundled for WebLogic. An example of this is the PitchFork jar within WebLogic has been changed excluding the spi package resulting in java.lang.ClassNotFoundException: org.springframework.jee.spi.PitchforkUtilsImpl errors.
    Moving the jars to the domain library path does not resolve any of the issues. I have been unable to successfully deploy the application picking up the application jars using the prefer-application-packages configuration.
    Oracle has advised me to deploy the libraries into the WebLogic system classpath by modifying the startWebLogic command to load the libraries into the classpath. I am concerned that modifying the system classpath will result in an unstable WebLogic server as I will be replacing modified jar files packages with WebLogic (such as PitchFork). This will also limit the applications that can be deployed within the server as each application must use the same libraries and versions (as the application ibraries are leing ignored).
    Has anyone else hit this issue and corrected it? Can anyone think of an alternative solution?
    Regards
    Neil

    Hi,
    I am in the process of updating the tracking bug# 331569 with copies of the eclipse EAR/WAR projects and the EAR for these scenarios. Here are some details on how I got past the 2nd CCE on the org.eclipse.persistence.jpa.PersistenceProvider class (not the javax one)
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=331569
    Essentially an SE persistence unit running both JPA 2.0 api and the 2.0 XSD schema work fine. I will next retest the EE case with variations of the 3 types of injection on the SSB or Servlet.
    Update: There are 3 (possibly 4) issues here (all of these may become obsolete when the next WLS version ships)Initially I got the same 2.0 schema error and the ClassCastException on org.eclipse.persistence.jpa.PersistenceProvider
    It turns out that my import of the 2 eclipse projects from my bug # 296271 for WebLogic 10.3.2.0 lost their facets(specifically the dynamic web facet) because I associated them with a different WebLogic 10.3.3.0. - this caused the CCE I was experiencing like Sri.
    Anyways, after creating an EAR/Web project combination from scratch in eclipse associated with the 10.3.3.0 instance - I predeployed/deployed/ran fine - even with the 2.0 schema - in SE bootstrap mode (no EE yet).
    Reproduction Procedure:
    redoing project from scratch as I noticed that the war was not at the root of the ear - it was a jar in the app-inf/lib dir - my imported eclipse project was not referenced correctly as a web module facet- create empty EAR and WAR project with references
    - download and open my EAR and WAR project code from bug # 296271
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=296271
    - do essentially all the steps in the page below (I paraphrase for re-verification)
    http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#DI_1.1:_Alternative_3:_Application_Level_Shared_Library_-InUse
    - copy applicationService, entity and FrontController servlet code into new projects
    - create persistence.xml and MANIFEST.MF manifest in src\META-INF
    - update manifest
    Class-Path: APP-INF/lib/eclipselink.jar
    APP-INF/lib/javax.persistence_2.0.0.v200911041116.jar
    - copy both javax.persistence 2.0 and eclipselink 2.x jars to APP-INF/lib
    - change ordering of WebLogic library modules classpath reference (javax.persistence 1.0) to ear reference (2.0 version)
    - update web.xml with servlet tags
    - update weblogic.xml with new context root
    - make the persistence unit name the same in persistence.xml and ApplicationManagedService
    - update weblogic-application.xml with prefer-application-packages overrides
    <wls:prefer-application-packages>
    <wls:package-name>javax.persistence.*</wls:package-name>
    <wls:package-name>org.eclipse.persistence.*</wls:package-name>
    </wls:prefer-application-packages>
    - enable server redirect logging
    <!-- new for 10.3.3.0 http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging#Server_Logging -->
    <property name="eclipselink.logging.logger" value="DefaultLogger"/>
    - start WebLogic 10.3.3.0
    - deploy (run on) server from eclipse or export ear to auto deploy directory
    1) JPA 2.0 XSD usage on 10.3.3.0
    - I reproduced this issue with a bad EAR
    - was able to use the 2.0 schema within the WAR-only application managed EAR
    persistence.xml<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <!-- persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"-->
    <persistence-unit name="example2" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>localJTA</jta-data-source>
    <class>org.eclipse.persistence.example.business.Cell</class>
    <shared-cache-mode>NONE</shared-cache-mode>
    <properties>
    <property name="eclipselink.target-server" value="WebLogic_10"/>
    <property name="eclipselink.logging.level" value="FINEST"/>
    <property name="eclipselink.target-database" value="Derby"/>
    <!-- new for 10.3.3.0 http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging#Server_Logging -->
    <property name="eclipselink.logging.logger" value="DefaultLogger"/>
    <!-- property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
    <property name="javax.persistence.jdbc.url" value="jdbc:derby://127.0.0.1:1527/dataparallel;create=true"/>
    <property name="javax.persistence.jdbc.user" value="APP"/>
    <property name="javax.persistence.jdbc.password" value="APP"/-->
    <!-- turn off DDL generation after the model is stable -->
    <!-- property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
    <property name="eclipselink.ddl-generation.output-mode" value="both"/-->
    </properties>
    </persistence-unit>
    </persistence>
    2) CCE on JPA provider implementation class
    Error instantiating the Persistence Provider class org.eclipse.persistence.jpa.PersistenceProvider of the PersistenceUnit example2: java.lang.ClassCastException: org.eclipse.persistence.jpa.PersistenceProvider
    - I reproduced and fixed this one (was Eclipse project facet issue) - EAR was wrong
    - was able to run JPA 2.0 code fine on an SE PU (predeploy/deploy together)
    - EE injection should not work but I will post an example EAR anyway
    log[EL Example]: enterprise: JPA 2.0 Metamodel: MetamodelImpl@56287508 [ 3 Types: , 1 ManagedTypes: , 1 EntityTypes: , 0 MappedSuperclassTypes: , 0 EmbeddableTypes: ]
    3) CCE on JPA spec interface class
    - I could not reproduce this one
    Re: WebLogic 11g EAR EJB Classpath and class loaders
    Error processing persistence unit PT of module pt: Error instantiating the Persistence Provider class org.eclipse.persistence.jpa.PersistenceProvider of the PersistenceUnit PT: java.lang.ClassCastException: org.eclipse.persistence.jpa.PersistenceProvider cannot be cast to javax.persistence.spi.PersistenceProvider
    4) CCE on fallback Kodo JPA provider (if an invalid say 2.1 JPA XSD schema is referenced)
    java.lang.ClassCastException: kodo.persistence.PersistenceProviderImpl
    at javax.persistence.Persistence.findAllProviders(Persistence.java:186)
    java.lang.NoSuchMethodError: javax/persistence/EntityManager.getMetamodel()Ljavax/persistence/metamodel/Metamodel;
    - reproduced by using the 1.0 javax.persistence jar (but named as the 2.0 one in APP-INF/lib)
    - fixed by using either the 1.0 or 2.0 JPA XSD schema and using the correct 2.0 spec jar
    thank you
    /michael

  • JNDI / EJB deployment and clustering

    I'm aware that replication isn't supported for stateful EJBs. But the
              "serialization of the handle isn't supported" statement has me concerned.
              So I'm looking for a little clarification on this scenario:
              Let's say I've got a stateful session bean, which is accessed from a
              servlet. For performance reasons, you want to find the colocated instance -
              the smart stub should do this, right? To have it colocated in all
              instances, then I need to deploy it into each server of the cluster. This
              essentially bind()/rebind()'s (whichever call the container does during a
              deploy operation) the EJB n times. Does each of those JNDI bind/rebind
              calls "overwrite" the previous one, or does the replicated JNDI tree somehow
              "keep" all the entries?
              What happens if I bind/rebind "non-cluster enabled" objects into the JNDI
              tree in each server to the same name (like a reference data table - doesn't
              really need to be an RMI object, one per server is fine)? Will they get
              "overwritten"? Should I need to take into account the server name when
              binding into the tree, and then also use that for subsequent lookups?
              Thanks for any input!
              --Jason
              

    Guys,
    Thanks for the information.
    The problem was that classpath, some other packages required for the Bean
    were not in the weblogic\classes directory.
    so that was it.
    Thanks
    /selvan
    Murali Krishna Devarakonda wrote in message
    <7qjkr1$7dl$[email protected]>...
    Are you using the HOT DEPLOY feature(startweblogic.bat does it)?
    Then you could go to the WebLogic Console, select the Bean, and Redploy.
    You could also do it from a command line utility "weblogic.deploy".
    If you didn't start the server with the hot deploy, you need to restartyour
    server after any changes.
    You should read the weblogic docs on the Hot Deploy feature. A different
    classloader is used for it. Also, the standard weblogic classpath cannot
    coexist with it.
    Hot Deploy uses: (assuming your weblogic installation is in D:/WebLogic
    D:\WebLogic\classes/boot
    It will throw an exception if you have D:\weblogic\classes or
    D:\WebLogic\lib\weblogicaux.jar in the system classpath. You need to use
    the weblogic.classpath instead.
    Regards,
    Murali Krishna Devarakonda
    Tamilselvan Ramasamy <[email protected]> wrote in message
    news:7qi0ln$kpc$[email protected]..
    Hello,
    I have created bunch of EJB Components and deployed for WLS4.0 using the
    following way. It works fine under WLS4.0
    To compile java code -> javac *.java
    Create SER file -> java weblogic.ejb.utils.DDCreator -d .
    DeploymentDescriptor.txt
    Create JAR file -> jar cmf manifest Bean.jar /directory
    EJBC and deployment -> java weblogic.ejbc -d /targetDirectory Bean.jar
    and also add an entry in the welogic.properties file
    weblogic.ejb.deploy= ...
    When I do the samething in the WLS4.5, it doesn't work, first of all,
    JNDI
    is not finding the home interface. It throws a naming Exception
    please give me an idea hw do I deploy my Beans in the WLS4.5 using the
    command line option. I don't have Visual Cafe to do that automatically.So
    I
    have to do that manually.
    Thanks
    /selvan
    Captura Software Inc
    [email protected]

  • EJB 3 and JBoss 5!!

    Hi,
    Currently I am working on EJB 3 and JBoss 5. I am new to this kind of environment. Now the present application is running on different platform. Basically when the customer/shop owner swipes a card in POS system we get message. Now I need to listen existing port and need to get that message then process it through using EJB3. We are not using servlets. JSP's , JMS.
    Is there anyway to start a thread to listen on port when the EJB is deployed? or Is there anyway to listen on port using JBoss or EJB?
    What is the best way to do it?
    Thanks in advance.
    Bachi.

    Yeah we can do that. In fact I tried it and it worked but as a stand alone application. I need to make sure that listens on the port when the application server starts or when the ejb is deployed. That is the problem here. In my first question I mentioned that we are not using JSP's right if there is any solution through servlets or JSP's I would like to use them.
    Here is the program which runs as standalone. Unfortunately I got this program from online :)
    import java.io.BufferedOutputStream;
    import java.io.IOException;
    import java.io.OutputStreamWriter;
    import java.net.ServerSocket;
    import java.net.Socket;
    public class BeanSocket implements Runnable {
         private Socket connection;
         private String TimeStamp;
         private int ID;
         Runnable runnable;
         BeanSocket(Socket s, int i) {
              this.connection = s;
              this.ID = i;
         public  static void main(String args[]){
              int port = 19999;
              int count = 0;
              try {
                   ServerSocket socket1 = new ServerSocket(port);
                   System.out.println("MultipleSocketServer Initialized");
                   while (true) {
                        Socket connection = socket1.accept();
                        Runnable runnable = new BeanSocket(connection, ++count);
                        Thread thread = new Thread(runnable);
                        thread.start();
              } catch (Exception e) {
         public void run() {
              try {
                   // need to wait 10 seconds to pretend that we're processing
                   // something
                   try {
                        Thread.sleep(1000);
                   } catch (Exception e) {
                        e.printStackTrace();
                   TimeStamp = new java.util.Date().toString();
                   String returnCode = "MultipleSocketServer repsonded at " + TimeStamp + (char) 13;
                   BufferedOutputStream os = new BufferedOutputStream(connection.getOutputStream());
                   OutputStreamWriter osw = new OutputStreamWriter(os, "US-ASCII");
                   osw.write(returnCode);
                   osw.flush();
              } catch (Exception e) {
                   System.out.println(e);
              } finally {
                   try {
                        connection.close();
                   } catch (IOException e) {
    }Edited by: bachi. on Jun 28, 2009 12:00 PM
    Edited by: bachi. on Jun 28, 2009 12:02 PM

  • DSO - What key fields and data fields in dso

    Hi experts,
    I need to create a dso in between the cube and 2 data sources(2lis_11_vaitm, 2lis_12_vcscl) to stage the data. My question is: what key fields and data fields to choose for the dso? is there a standard dso to copy? please explain in detail the model to set up, whether to connect both the ds's to dso and then to cube or one ds to dso and the other to the cube. more details will help.

    Check this for standard DSO:
    http://help.sap.com/saphelp_nw04/helpdata/en/43/fcdc387f34384f94c3227baf3837a8/content.htm
    Thanks...
    Shambhu

  • Reading MS Project column names and data on the fly from a selected View

    Hi guys,
    I have several views on my project file (MSPROJECT 2010) and I want to build a macro so that;
    1. User can select any view ( Views can have diffrent columns and the user may add new columns as well)
    2. User runs the Macro and all the coulmns along with the tasks displayed in the view will be written to a excel file. ( I don't want to build several macro's for each view, I'm thinking of a common method which would work for any selected view)
    The problem I'm facing is that how will i read the column names and data for a particular view on the fly without hard coding them inside the vba code ?
    The solution needs to work on a master schedule as well.
    Appreciate your feedback.

    Just to get you started the following code writes the field name and data for the active task to the Immediate window.
    Sub CopyData()
    Dim fld As TableField
    For Each fld In ActiveProject.TaskTables(ActiveProject.CurrentTable).TableFields
    If fld.Field >= 0 Then
    Debug.Print Application.FieldConstantToFieldName(fld.Field), ActiveCell.Task.GetField(fld.Field)
    End If
    Next fld
    End Sub
    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

  • Pdf portfolio source file name and date in file details

    Is it possible to import the source file name and extension as well as the source file created date in the portfolio file details?  Need to document source to portfolio in working with 3rd parties that will only have the original source.  Need to document what was converted into pdf as not all files in a directory will successfully convert to pdf.  Sometimes need to convert 100's of files.  Manual entry is inefficient.  the file names and modified dates are displayed on the Combine Files dialog.  is there a way to capture the detail on that page?

    I don't need the detail of when the pdf was added to the portfolio.  I
    need know which dwg or jpg or word file was converted and the original
    created date of that file for control of information.
    That is impossible; sorry. For some *very specific* types of conversion to PDF the pdfx:SourceModified XMP tag will be set to show the last-modification date of the source file (for example DOCX files converted using MS Word), but there will never be a human-readable record of the source filename or its creation date unless you have manually added them as document XMP properties after conversion (this is what the "Custom Properties" dialog is for). To embed source data automatically would raise no end of privacy and security problems for customers, who most certainly do NOT want their recipients seeing details of internal documents.
    Without writing a plugin there's no access to the internal workflow of the Combine Files dialog, so you cannot use a script to read the names and dates of the files *before* conversion and store them automatically in the new PDF Portfolio's Fields array.

  • Who worked with ICS' Model 4896 GPIB? I can not count the data from the module. Can prompt as it to make. It is desirable with examples (data read-out from the module and data transmission between channels. It is in advance grateful.

    I can not count the data from the module. Can prompt as it to make. It is desirable with examples (data read-out from the module and data transmission between channels. It is in advance grateful.

    Hello. Most of the engineers in developer exchange are more familiar
    with NI products. Contacting ICS for technical support is a better
    course of action.

Maybe you are looking for