Mapping with SQL

Hello I have one general question.
At the moment everything looks like this:
database table:
name | firstdate | seconddate
asdf | 06/02/06 | 06/02/18
java object:
name | firstdate | seconddate
asdf | 06/02/06 | 06/02/18
I try to achieve adding a column to the java object in this way:
java object:
name | firstdate | seconddate | duration
asdf | 06/02/06 | 06/02/18 | 12
The values should be queried from the table like
SELECT name, firstdate, seconddate, (seconddate-firstdate) duration FROM table
Does anyone knows if that is possible, and when, is there an example how to achieve that?
Thanks for replying.

If the value is just a computed value, you may be better off computing it in Java, instead of the database. You would not even need a variable, just have a getDuration method that computed the duration from the two dates.
If you really wanted the variable you could lazy initialize it, and reset it when either of the dates are changed.
If you must compute the value in the database you could either define a view in the database that adds the column and map to the view instead of the table, or use custom SQL for all queries for the class that add in the computed column. You could also just add the column to the database.

Similar Messages

  • Who use sql-mapping with java.util.regex?

    Hi everyone:
    I use the IBatis SQL-Mapping and I think it is very good.Now I want to add the search function to my BBS forum.I also want to display the content high light like jive.I mean that if I want to find the string "ibatis",then the search result "ibatis" will be high light displayed.
    So I must use the java.util.regex in jsdk1.4.But the problem is that what I get is a List if I use sql-mapping.For example:
              String resource="conf/XML/sql/lyo-sql-map.xml";
              Reader reader=Resources.getResourceAsReader(resource);
              sqlmap=XmlSqlMapBuilder.buildSqlMap(reader);
              List articlelist=sqlmap.executeQueryForList("selectSiteArticle","%"+icontent+"%");
    The result I get is a List and I have no time to use regex.
    I don't know whether I could do this:
    Iterate the List,use the regex and later place all the object back to the List.
    It's right?
    How to use regex with sql-mapping?Thks

    Any idea? :(

  • Migrating CMP EJB mapped to SQL Server table with identity column from WL

    Hi,
        I want to migrate an application from Weblogic to SAP Netweaver 2004s (7.0). We had successfully migrated this application to an earlier version of Netweaver. I have a number of CMP EJBs which are mapped to SQL Server tables with the PK as identity columns(autogenerated by SQL Server). I am having difficulty mapping the same in persistant.xml. This scenario works perfectly well in Weblogic and worked by using ejb-pk in an earlier version of Netweaver.
       Please let me know how to proceed.
    -Sekhar

    I suspect it is the security as specified in the message. E.g .your DBA set the ID columns so no user can override values in it.
    And I suggest you 1st put the data into a staging table, then push it to the destination, this does not resolve the issue, but ensures better processing.
    Arthur
    MyBlog
    Twitter

  • Toplink with sql server

    I have sucessfully used Toplink with Oracle. ow I have to use it with MS SQL server and I am having problems. First of all, in the Mapping Worbench, the only SQL server driver listed is weblogic.jdbc.mssqlserver4.Driver. Why can't I use the regular ms sql driver, com.microsoft.jdbc.sqlserver.SQLServerDriver? Why should the mapping workbench be tied to Weblogic? If one did not have Weblogic, would it be impossible to use Toplink with SQL server? Well, I have Weblogic, so I tried using the weblogic driver with the url jdbc:microsoft:sqlserver://<host ip>:1433;DatabaseName=<db name>. When I try to connect, a dialog box appears that says: "java.sql.SQLException $$$$$$$$$$ License Exception $$$$$$$$$$ Missing license for: WebLogic Server 6.1. $$$$$$$$$$ License Exception $$$$$$$$$$ Username or password could be invalid." I have weblogic.jar in the classpath. I tried adding the line SET WLS61_HOME=M:\bea610\wlserver6.1 to workbench.cmd. It didn't help. Any suggestions?

    I already tried this. It does not work. I put the following jars in the classpath in workbench.cmd: msbase.jar;mssqlserver.jar;msutil.jar. Then I start workbench. When I try to enter com.microsoft.jdbc.sqlserver.SQLServerDriver as the driver, I get an exception. Here is the stacktrace:
    Exception occurred during event dispatching:
    java.lang.ClassCastException: com.webgain.openapi.foundation.uitools.WGDefaultListModel
         at com.webgain.workbench.ui.db.BldrLoginInfoPanel.actionPerformed(Unknown Source)
         at com.webgain.openapi.foundation.uitools.WGListChooser.fireActionEvent(WGListChooser.java:664)
         at com.webgain.openapi.foundation.uitools.WGListChooser$ListDataHandler.contentsChanged(WGListChooser.java:473)
         at javax.swing.AbstractListModel.fireContentsChanged(Unknown Source)
         at com.webgain.openapi.foundation.uitools.WGDefaultListModel.setSelectedItem(WGDefaultListModel.java:740)
         at com.webgain.openapi.foundation.uitools.WGListChooser.setSelectedItem(WGListChooser.java:1446)
         at com.webgain.openapi.foundation.plaf.basic.WGBasicListChooserUI$ListChooserModel.setSelectedItem(WGBasicListChooserUI.java:527)
         at javax.swing.JComboBox.actionPerformed(Unknown Source)
         at javax.swing.plaf.basic.BasicComboBoxUI$EditorFocusListener.focusLost(Unknown Source)
         at java.awt.AWTEventMulticaster.focusLost(Unknown Source)
         at java.awt.AWTEventMulticaster.focusLost(Unknown Source)
         at java.awt.Component.processFocusEvent(Unknown Source)
         at javax.swing.JComponent.processFocusEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.setFocusRequest(Unknown Source)
         at java.awt.Container.proxyRequestFocus(Unknown Source)
         at java.awt.Container.proxyRequestFocus(Unknown Source)
         at java.awt.Container.proxyRequestFocus(Unknown Source)
         at java.awt.Container.proxyRequestFocus(Unknown Source)
         at java.awt.Container.proxyRequestFocus(Unknown Source)
         at java.awt.Container.proxyRequestFocus(Unknown Source)
         at java.awt.Container.proxyRequestFocus(Unknown Source)
         at java.awt.Container.proxyRequestFocus(Unknown Source)
         at java.awt.Component.requestFocus(Unknown Source)
         at javax.swing.JComponent.grabFocus(Unknown Source)
         at javax.swing.JComponent.requestFocus(Unknown Source)
         at javax.swing.text.DefaultCaret.mousePressed(Unknown Source)
         at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
         at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
         at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at com.webgain.openapi.foundation.uitools.WGPasswordField.processMouseEvent(WGPasswordField.java:99)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    If I ignore the exception and try to connect to the database anyway, it tries to use the weblogic driver.
    Next I manually edited the database xml file and put in the driver name automatically. When I bought up the mapping workbench again, it again threw an exception. However, the correct driver name was in the file, so it did finally let me connect to the database. So it seems there IS a bug, although it has to do with the GUI and not SQL server per se.

  • Runtime-Error after deploying a mapping with the generated script

    For example a very easy scenario:
    1. Create a table and a view in a DB-schema, witch ist registered as WB-target-schema with the following scripts:
    create view v1(c1) as select 'a' c1 from dual;
    create table t1(c1 varchar2(1));
    2. Import the table and the view into a OWB-module
    3. Create a mapping ‘m1’
    4. Drag and drop view and table into the mapping
    5. Draw an arrow from the view-column to the table-column
    6. Save and close the mapping
    7. Mark the mapping in the ‘Design Center’ and klick the ‘Generate’-Button
    8. Save the generated script ‘M1.pls’ to file
    9. Run the script in SQL*Plus, connected with the target-schema (without using the Control Center Manager)
    => very easy right now ;-)
    10. Start the mapping with the following script will produce the following error
    SQL> declare
    2 v_status varchar2(100);
    3 begin
    4 m1.main(v_status);
    5 end;
    6 /
    declare
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at "OWB_OWN.WB_RT_MAPAUDIT_UTIL", line 1027
    ORA-06512: at "SCOTT.M1", line 2048
    ORA-06512: at line 4
    If i delete or comment the four WB_RT_MAPAUDIT_UTIL-calls - it work´s fine!
    But is this a good advise?
    What exactly does the wrapped package ‘WB_RT_MAPAUDIT_UTIL do?
    Thanks
    jwehner

    I just ran into the same problem myself. I used the same technique of saving the generated OWB script to file and then compiling it through sqlplus. When I used the "Deploy" option for the mapping, then the problem went away. So when OWB is deploying the code it seems to be setting something internally that doesn't get set when you simple compile the PL/SQL. I don't know of any workaround to this. I will need it eventually, since I don't want to use the UI to deploy to various test environments and production. Maybe the built-in scripting language is the way to go.

  • Mapping with xml-schema XML-data to relational tables

    Hello,
    is it possible to map data from xml documents to relational tables with xml-schema?
    I mean not in nested tables but in relational tables with primary and foreign keys!
    With SQL Server 2005 it is very easy, I dont believe that Oracle couldn't do this!
    I searched but i cant find anything about that!
    Thx
    user445232

    indeed, oracle does this for xml schema based xmltype data, however, these underlying tables are not accessable to the application. Maybe It should for next version, so folks who like to use relational model can use it without mapping it manually.
    Actually, nested tables, are the same, their underlying tables (segments) are indeed relational tables, oracle manages them internally and not visiable to the application. You can find them in the user_segments, user_objects views though.

  • Data Associtions not enabling  while i am  trying to do data mapping with data Associtions in BPM studio what is the reson?

    Data Associtions not enabling  while i am  trying to do data mapping with data Associtions in BPM studio what is the reson?

    Shouldn't @StartDate be an input parameter to the stored procedure? @RunDate also?
    Example for sp with parameters:
    http://www.sqlusa.com/bestpractices2008/stored-procedure-parameters/
    The last error will go away upon a successful sp compile.
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Owb beta 3 / master detail mapping with sequence ora-00936 error

    I'm not able to use sequence operator in mapping to create relationships between different record type from the same flat file. I have got an sql error ORA-00936: expression absente
    The problem seem to be the sequence is not referenced in the sql loader parameter. The sequence exists, was deployed sucessfully, the mapping is validated and successfully deployed. The problem occurs during execution

    Good afternoon "micwic",
    In general, mappings with flat files make use of data generators, not sequence operators. This is what the User Guide (10gR1 but I guess R2 works similar) says for the Data Generator Operator :
    Use a Data Generator operator to provide information such as record number, system date, and sequence values.
    For mappings with flat file sources, the Data Generator operator also provides a place to enter constant information. For mappings with Flat File sources and targets, the Data Generator operator connects the mapping to SQL*Loader to generate the data stored in the database record.
    The following functions are available:
    RECNUM
    SYSDATE
    SEQUENCE
    It is possible for Warehouse Builder to generate data by specifying only sequences, record numbers, system dates, and constants as field specifications. SQL*Loader inserts as many records as are specified by the LOAD keyword.
    Setting a Column to the Data File Record Number
    Use the RECNUM keyword to set an attribute to the number of the records that tthe record was loaded from. Records are counted sequentially from the beginning of the first data file, starting with record 1. RECNUM increments as each logical record is assembled. It increments for records that are discarded, skipped, rejected, or loaded.
    For example, if you use the option SKIP=10, the first record loaded has a RECNUM of 11.
    Setting a Column to the Current Date
    A column specified with SYSDATE gets the current system date, as defined by the SQL language SYSDATE function.
    The target column must be of type CHAR or DATE. If the column is of type CHAR, then the date is loaded in the format dd-mon-yy. After the load, you only access it in that format. If the system date is loaded into a DATE column, then you can only access it in a variety of formats including the time and the date. A new system date/time is used for each array of records inserted in a conventional path load and for each block of records loaded during a direct path load.
    Setting a Column to a Unique Sequence Number
    The SEQUENCE keyword ensures a unique value for a column. SEQUENCE increments for each record that is loaded or rejected. It does not increment for records that are discarded or skipped.
    Recommendation: For PL/SQL mappings use a Constant Operator or Mapping Sequence Operator instead of a Data Generator.
    etc.
    Good luck, Patrick

  • BC4J Custom Type Maps   (MS-SQL cont.)

    (FYI using JDeveloper 9.0.2.0.0, MS-SQL 2000 spk2 and MS-SQL's JDBC driver Version 2.2.0022)
    In the process of trying to get JDeveloper working fully with MS-SQL, I am at the point of developing a custom type map.
    Should this typemap include all mappings or only those different than the "Java" or "Oracle" type map? I was assuming all at first. Now I wonder how it's handling missing mappings.
    How does it find a matching typemap? I noticed that Entity's database column types looked like "int(10,0)" and "bit(1,0)", but in my typemap, like the examples, it's just "INT", "BIT" with no precision, scale. Is this a case of where it's assuming the driver will return a string for type and it's returning type(p,s)? Or is JDev building that string? Either way, would you need a different mapping for "bit(1,0)" than "bit"?
    As "bit(1,0)" it had problems with both the Java map and my custom map. Changing it to "bit" seem to get it to work. So what typemapping was it trying to use as "bit(1,0)"?
    [Bug?] I noticed that when I view the bc4j settings (project (rt-click) -> edit business components project), the value for type map is incorrect if I am using a custom type map. If I am using the Java type map it says "Java" in the greyed out select, but if I am using my custom map ("MS-SQL"), it says "Oracle". I checked the bc4j.xcfg for the one using my custom map and it does say the right class name for jbo.TypeMapEntries.
    On a related note, when testing the bc4j modules, we are instructed to use the edited local configuration, but how do view/edit the project default configuration?
    ====================================================================
    typemap in progress...
    ================================
    public class MsSqlTypeMapEntries
    public MsSqlTypeMapEntries()
    /* ColumnType, JavaClassName, JdbcSqlType, JdbcSqlTypeID, DefaultDisplayLength, isNumericType */
    new JboTypeMap("BIGINT", "java.math.BigInteger", "BIGINT",java.sql.Types.BIGINT,null,true);
    //new JboTypeMap("BIGINT IDENTITY", "java.math.BigInteger", "BIGINT",java.sql.Types.BIGINT,null,true);
    //new JboTypeMap("BINARY BINARY
    new JboTypeMap("BIT","java.lang.Boolean","BIT",java.sql.Types.BIT,null,true);
    new JboTypeMap("CHAR","java.lang.String","CHAR",java.sql.Types.CHAR,null);
    new JboTypeMap("DATETIME" ,"java.sql.Timestamp","TIMESTAMP",java.sql.Types.TIMESTAMP ,null);
    new JboTypeMap("DECIMAL","java.math.BigDecimal","DECIMAL",java.sql.Types.DECIMAL,null,true);
    //new JboTypeMap("DECIMAL() IDENTITY DECIMAL
    //new JboTypeMap("FLOAT FLOAT
    //new JboTypeMap("IMAGE LONGVARBINARY
    new JboTypeMap("INT","java.lang.Integer","INTEGER",java.sql.Types.INTEGER,null,true);
    new JboTypeMap("INT IDENTITY","java.lang.Integer","INTEGER",java.sql.Types.INTEGER,null,true);
    new JboTypeMap("MONEY","java.math.BigDecimal","DECIMAL",java.sql.Types.DECIMAL,null,true);
    new JboTypeMap("NCHAR","java.lang.String","CHAR",java.sql.Types.CHAR,null);
    new JboTypeMap("NTEXT","java.lang.String","LONGVARCHAR", java.sql.Types.LONGVARCHAR, null);
    new JboTypeMap("NUMERIC","java.math.BigDecimal","NUMERIC",java.sql.Types.NUMERIC,null,true);
    //new JboTypeMap("NUMERIC() IDENTITY","java.math.BigDecimal","NUMERIC",java.sql.Types.NUMERIC,null,true);
    new JboTypeMap("NVARCHAR","java.lang.String","VARCHAR",java.sql.Types.VARCHAR,null);
    //new JboTypeMap("REAL REAL
    new JboTypeMap("SMALLDATETIME" ,"java.sql.Date","TIMESTAMP",java.sql.Types.TIMESTAMP ,null);
    new JboTypeMap("SMALLINT","java.lang.Integer","SMALLINT",java.sql.Types.SMALLINT,null,true);
    new JboTypeMap("SMALLINT IDENTITY","java.lang.Integer","SMALLINT",java.sql.Types.SMALLINT,null,true);
    new JboTypeMap("SMALLMONEY","java.math.BigDecimal","DECIMAL",java.sql.Types.DECIMAL,null,true);
    new JboTypeMap("SQL_VARIANT","java.lang.String","VARCHAR",java.sql.Types.VARCHAR,null);
    new JboTypeMap("SYSNAME","java.lang.String","VARCHAR",java.sql.Types.VARCHAR,null);
    new JboTypeMap("TEXT","java.lang.String","LONGVARCHAR", java.sql.Types.LONGVARCHAR, null);
    //new JboTypeMap("TIMESTAMP BINARY
    new JboTypeMap("TINYINT","java.lang.Integer","TINYINT",java.sql.Types.TINYINT,null,true);
    new JboTypeMap("TINYINT IDENTITY","java.lang.Integer","TINYINT",java.sql.Types.TINYINT,null,true);
    new JboTypeMap("UNIQUEIDENTIFIER","java.lang.String","CHAR",java.sql.Types.CHAR,null);
    //new JboTypeMap("VARBINARY VARBINARY
    new JboTypeMap("VARCHAR","java.lang.String","CHAR",java.sql.Types.CHAR,null);
    }

    (FYI using JDeveloper 9.0.2.0.0, MS-SQL 2000 spk2 and MS-SQL's JDBC driver Version 2.2.0022)
    In the process of trying to get JDeveloper working fully with MS-SQL, I am at the point of developing a custom type map.
    Should this typemap include all mappings or only those different than the "Java" or "Oracle" type map? I was assuming all at first. Now I wonder how it's handling missing mappings.
    How does it find a matching typemap? I noticed that Entity's database column types looked like "int(10,0)" and "bit(1,0)", but in my typemap, like the examples, it's just "INT", "BIT" with no precision, scale. Is this a case of where it's assuming the driver will return a string for type and it's returning type(p,s)? Or is JDev building that string? Either way, would you need a different mapping for "bit(1,0)" than "bit"?
    As "bit(1,0)" it had problems with both the Java map and my custom map. Changing it to "bit" seem to get it to work. So what typemapping was it trying to use as "bit(1,0)"?
    [Bug?] I noticed that when I view the bc4j settings (project (rt-click) -> edit business components project), the value for type map is incorrect if I am using a custom type map. If I am using the Java type map it says "Java" in the greyed out select, but if I am using my custom map ("MS-SQL"), it says "Oracle". I checked the bc4j.xcfg for the one using my custom map and it does say the right class name for jbo.TypeMapEntries.
    On a related note, when testing the bc4j modules, we are instructed to use the edited local configuration, but how do view/edit the project default configuration?
    ====================================================================
    typemap in progress...
    ================================
    public class MsSqlTypeMapEntries
    public MsSqlTypeMapEntries()
    /* ColumnType, JavaClassName, JdbcSqlType, JdbcSqlTypeID, DefaultDisplayLength, isNumericType */
    new JboTypeMap("BIGINT", "java.math.BigInteger", "BIGINT",java.sql.Types.BIGINT,null,true);
    //new JboTypeMap("BIGINT IDENTITY", "java.math.BigInteger", "BIGINT",java.sql.Types.BIGINT,null,true);
    //new JboTypeMap("BINARY BINARY
    new JboTypeMap("BIT","java.lang.Boolean","BIT",java.sql.Types.BIT,null,true);
    new JboTypeMap("CHAR","java.lang.String","CHAR",java.sql.Types.CHAR,null);
    new JboTypeMap("DATETIME" ,"java.sql.Timestamp","TIMESTAMP",java.sql.Types.TIMESTAMP ,null);
    new JboTypeMap("DECIMAL","java.math.BigDecimal","DECIMAL",java.sql.Types.DECIMAL,null,true);
    //new JboTypeMap("DECIMAL() IDENTITY DECIMAL
    //new JboTypeMap("FLOAT FLOAT
    //new JboTypeMap("IMAGE LONGVARBINARY
    new JboTypeMap("INT","java.lang.Integer","INTEGER",java.sql.Types.INTEGER,null,true);
    new JboTypeMap("INT IDENTITY","java.lang.Integer","INTEGER",java.sql.Types.INTEGER,null,true);
    new JboTypeMap("MONEY","java.math.BigDecimal","DECIMAL",java.sql.Types.DECIMAL,null,true);
    new JboTypeMap("NCHAR","java.lang.String","CHAR",java.sql.Types.CHAR,null);
    new JboTypeMap("NTEXT","java.lang.String","LONGVARCHAR", java.sql.Types.LONGVARCHAR, null);
    new JboTypeMap("NUMERIC","java.math.BigDecimal","NUMERIC",java.sql.Types.NUMERIC,null,true);
    //new JboTypeMap("NUMERIC() IDENTITY","java.math.BigDecimal","NUMERIC",java.sql.Types.NUMERIC,null,true);
    new JboTypeMap("NVARCHAR","java.lang.String","VARCHAR",java.sql.Types.VARCHAR,null);
    //new JboTypeMap("REAL REAL
    new JboTypeMap("SMALLDATETIME" ,"java.sql.Date","TIMESTAMP",java.sql.Types.TIMESTAMP ,null);
    new JboTypeMap("SMALLINT","java.lang.Integer","SMALLINT",java.sql.Types.SMALLINT,null,true);
    new JboTypeMap("SMALLINT IDENTITY","java.lang.Integer","SMALLINT",java.sql.Types.SMALLINT,null,true);
    new JboTypeMap("SMALLMONEY","java.math.BigDecimal","DECIMAL",java.sql.Types.DECIMAL,null,true);
    new JboTypeMap("SQL_VARIANT","java.lang.String","VARCHAR",java.sql.Types.VARCHAR,null);
    new JboTypeMap("SYSNAME","java.lang.String","VARCHAR",java.sql.Types.VARCHAR,null);
    new JboTypeMap("TEXT","java.lang.String","LONGVARCHAR", java.sql.Types.LONGVARCHAR, null);
    //new JboTypeMap("TIMESTAMP BINARY
    new JboTypeMap("TINYINT","java.lang.Integer","TINYINT",java.sql.Types.TINYINT,null,true);
    new JboTypeMap("TINYINT IDENTITY","java.lang.Integer","TINYINT",java.sql.Types.TINYINT,null,true);
    new JboTypeMap("UNIQUEIDENTIFIER","java.lang.String","CHAR",java.sql.Types.CHAR,null);
    //new JboTypeMap("VARBINARY VARBINARY
    new JboTypeMap("VARCHAR","java.lang.String","CHAR",java.sql.Types.CHAR,null);
    }

  • EclipseLink Direct Map with Joining mapping issue

    Hi EclipseLink Team,
    We encountered an issue to map an attribute as Direct Map with Join Fetch enabled in EclipseLink Workbench 1.1.1 (Build v20090430-r4097).
    Basically, we have the following data model:
    SESSION
    SESS_NO (PK),
    PARAM_SESS
    SESS_NO (FK) (PK),
    PARAM_NAME (PK),
    PARAM_VALUE
    Then we have Session.java persistent entity associated with SESSION table. This class contains Map attribute sessionParameters which we map as Direct Map with PARAM_SESS.PARAM_NAME as key and PARAM_SESS.PARAM_VALUE as value (referenced by PARAM_SESS.SESS_NO = SESSION.SESS_NO).
    The described mapping works fine without Joining enabled (both for Lazy and Eager Loading).
    But we have cases when we want to get parameters for a number of sessions. And disabling of Joining leads to a number of performed SELECT SQL queries (both for Lazy and Eager Loading) those are bad for performance.
    So we have chosen the Eager Loading and set the Join Fetch option to Outer. Then we have got the following:
    I see in the log the only SQL query performed: SELECT DISTINCT t0.SESS_NO, …, t1.PARAM_VALUE, t1.PARAM_NAME FROM {oj SESSION t0 LEFT OUTER JOIN PARAM_SESS t1 ON (t1.SESS_NO = t0.SESS_NO)}. This is pretty good for us. This query returns exactly what we expect when executing on the database. But the Map attribute for every session is populated incorrectly: Maps are empty (not corresponding to available relational data).
    Could you please let us know if this is a bug, or kind of known issue or we made something wrong? Some hints and proposals would be very helpful and appreciated.
    I should mention that for now we want to map all of this for read only purpose.
    Thanks.
    Best Regards,
    Alexey Elisawetski

    James,
    I've tried both 1.2 release and 2.0 (v20091121-r5847) but received the same result - empty Map.
    Moreover, for both versions the following string was absent in deployed XML file:
    +<direct-key-field table="PARAM_SESS" name="PARAM_NAME" xsi:type="column"/>+
    Therefore, on application initialization I have got an exception: org.eclipse.persistence.exceptions.DescriptorException with message This descriptor contains a mapping with a DirectMapMapping and no key field set.
    So I was forced to add the line manually.
    This seems buggy to me...
    Regards,
    Alexey

  • TIMESTAMPS need help with sql please!!!!

    I am trying to get back a map from a database that is no problem but, all maps have a time stamps so to I try to retrive the map with a where statment to the time stamp the sql is bellow
    query = "SELECT MAP.MAP FROM MAP WHERE MAP.MAP_DATE = '"+ timestamp_str +"';";
    timestamp_str is a string with the value "2003-02-25 22:21:43.356"

    I for got to put in the problem sorry the problem is I get the error
    com.borland.datastore.q2.QueryError: [line 1, col 44] Operator = doesn't apply to the types <TIMESTAMP> and <STRING>
    I think the problem is that I am comparing it to a string so does any one know how to convert these string values to a time stamp????

  • FDMEE/LCM : LCM is merging target server maps with source server maps

    Hi,
    We would like to copy thanks to LCM our FDMEE application from production to developpement server.
    We have done several tests on developpement that we would like to remove.
    We need to have production/development environnement AS-IS.
    The problem is that LCM is merging taret server location / data load rule / import format / maps with the source one.
    We have opened an SR on this subject.
    Meanwhile we would like to create a SQL request to clean import format / data load rule / location / maps table within target server before the LCM import.
    Is that ok if we delete all records on these following table or could we have an impact ?
    - AIF_BALANCE_RULES (Data load rule table)
    - TDATAMAP / TDATAMAP_STG /TDATAMAPSEG (maps tables)
    - TPOVPARTITION (location table)
    - TBHVIMPGROUP; TBHVIMPITEMFILE (import format table)
    What do you think ?
    Thanks.
    Regards,
    Yohan

    That's a comment in the file. It has no effect at all.

  • How to make column headers in table in PDF report appear bold while datas in table appear regular from c# windows forms with sql server2008 using iTextSharp

    Hi my name is vishal
    For past 10 days i have been breaking my head on how to make column headers in table appear bold while datas in table appear regular from c# windows forms with sql server2008 using iTextSharp.
    Given below is my code in c# on how i export datas from different tables in sql server to PDF report using iTextSharp:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Data.SqlClient;
    using iTextSharp.text;
    using iTextSharp.text.pdf;
    using System.Diagnostics;
    using System.IO;
    namespace DRRS_CSharp
    public partial class frmPDF : Form
    public frmPDF()
    InitializeComponent();
    private void button1_Click(object sender, EventArgs e)
    Document doc = new Document(PageSize.A4.Rotate());
    var writer = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
    doc.SetMargins(50, 50, 50, 50);
    doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height));
    doc.Open();
    PdfPTable table = new PdfPTable(6);
    table.TotalWidth =530f;
    table.LockedWidth = true;
    PdfPCell cell = new PdfPCell(new Phrase("Institute/Hospital:AIIMS,NEW DELHI", FontFactory.GetFont("Arial", 14, iTextSharp.text.Font.BOLD, BaseColor.BLACK)));
    cell.Colspan = 6;
    cell.HorizontalAlignment = 0;
    table.AddCell(cell);
    Paragraph para=new Paragraph("DCS Clinical Record-Assigned Dialyzer",FontFactory.GetFont("Arial",16,iTextSharp.text.Font.BOLD,BaseColor.BLACK));
    para.Alignment = Element.ALIGN_CENTER;
    iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo5.png");
    png.ScaleToFit(105f, 105f);
    png.Alignment = Element.ALIGN_RIGHT;
    SqlConnection conn = new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
    SqlCommand cmd = new SqlCommand("Select d.dialyserID,r.errorCode,r.dialysis_date,pn.patient_first_name,pn.patient_last_name,d.manufacturer,d.dialyzer_size,r.start_date,r.end_date,d.packed_volume,r.bundle_vol,r.disinfectant,t.Technician_first_name,t.Technician_last_name from dialyser d,patient_name pn,reprocessor r,Techniciandetail t where pn.patient_id=d.patient_id and r.dialyzer_id=d.dialyserID and t.technician_id=r.technician_id and d.deleted_status=0 and d.closed_status=0 and pn.status=1 and r.errorCode<106 and r.reprocessor_id in (Select max(reprocessor_id) from reprocessor where dialyzer_id=d.dialyserID) order by pn.patient_first_name,pn.patient_last_name", conn);
    conn.Open();
    SqlDataReader dr;
    dr = cmd.ExecuteReader();
    table.AddCell("Reprocessing Date");
    table.AddCell("Patient Name");
    table.AddCell("Dialyzer(Manufacturer,Size)");
    table.AddCell("No.of Reuse");
    table.AddCell("Verification");
    table.AddCell("DialyzerID");
    while (dr.Read())
    table.AddCell(dr[2].ToString());
    table.AddCell(dr[3].ToString() +"_"+ dr[4].ToString());
    table.AddCell(dr[5].ToString() + "-" + dr[6].ToString());
    table.AddCell("@count".ToString());
    table.AddCell(dr[12].ToString() + "-" + dr[13].ToString());
    table.AddCell(dr[0].ToString());
    dr.Close();
    table.SpacingBefore = 15f;
    doc.Add(para);
    doc.Add(png);
    doc.Add(table);
    doc.Close();
    System.Diagnostics.Process.Start("AssignedDialyzer.pdf");
    if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.Yes)
    var writer2 = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
    else if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.No)
    this.Close();
    The above code executes well with no problem at all!
    As you can see the file to which i create and save and open my pdf report is
    AssignedDialyzer.pdf.
    The column headers of table in pdf report from c# windows forms using iTextSharp are
    "Reprocessing Date","Patient Name","Dialyzer(Manufacturer,Size)","No.of Reuse","Verification" and
    "DialyzerID".
    However the problem i am facing is after execution and opening of document is my
    column headers in table in pdf report from
    c# and datas in it all appear in bold.
    I have browsed through net regarding to solve this problem but with no success.
    What i want is my pdf report from c# should be similar to following format which i was able to accomplish in vb6,adodb with MS access using iTextSharp.:
    Given below is report which i have achieved from vb6,adodb with MS access using iTextSharp
    I know that there has to be another way to solve my problem.I have browsed many articles in net regarding exporting sql datas to above format but with no success!
    Is there is any another way to solve to my problem on exporting sql datas from c# windows forms using iTextSharp to above format given in the picture/image above?!
    If so Then Can anyone tell me what modifications must i do in my c# code given above so that my pdf report from c# windows forms using iTextSharp will look similar to image/picture(pdf report) which i was able to accomplish from
    vb6,adodb with ms access using iTextSharp?
    I have approached Sound Forge.Net for help but with no success.
    I hope anyone/someone truly understands what i am trying to ask!
    I know i have to do lot of modifications in my c# code to achieve this level of perfection but i dont know how to do it.
    Can anyone help me please! Any help/guidance in solving this problem would be greatly appreciated.
    I hope i get a reply in terms of solving this problem.
    vishal

    Hi,
    About iTextSharp component issue , I think this case is off-topic in here.
    I suggest you consulting to compenent provider.
    http://sourceforge.net/projects/itextsharp/
    Regards,
    Marvin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to do it with SQL Loader

    All,
    I have two tables HEADER_TABLE and LINE_TABLE. Each header record can have multiple line records. I have to load data from a flat file to these tables.Flat file can have two types of records. H-Header, L-Line. It looks as follows.. Each H record can have multiple corresponding L records
    H..........
    L.......
    L......
    L......
    H.........
    L.......
    L......
    L......
    I have HEADER_ID column in HEADER_TABLE and HEADER_ID, LINE_ID columns in the LINE_TABLE.
    While loading data using SQL Loader, I need to generate HEADER_ID and LINE_ID values as follows and load them.
    H..........<HEADER_ID = 1>
    L....... <HEADER_ID = 1><LINE_ID = 1>
    L...... <HEADER_ID = 1><LINE_ID = 2>
    L...... <HEADER_ID = 1><LINE_ID = 3>
    H......... <HEADER_ID = 2>
    L....... <HEADER_ID = 2><LINE_ID = 4>
    L...... <HEADER_ID = 2><LINE_ID = 5>
    L...... <HEADER_ID = 2><LINE_ID = 6>
    Is it possible to do this with SQL LODER?
    I tried to do this with sequences. But it loaded the tables as follows.
    H..........<HEADER_ID = 1>
    L....... <HEADER_ID = 1><LINE_ID = 1>
    L...... <HEADER_ID = 1><LINE_ID = 2>
    L...... <HEADER_ID = 1><LINE_ID = 3>
    H......... <HEADER_ID = 2>
    L....... <HEADER_ID = 1><LINE_ID = 4>
    L...... <HEADER_ID = 1><LINE_ID = 5>
    L...... <HEADER_ID = 1><LINE_ID = 6>
    Thanks
    Ketha

    Morgan,
    Examples given in the link are quite generic and I have tried them. But my requirement is focused on generating header_id and line_id values as i have described. It seems that SQLLDR scans all records for a particular WHEN clause and insert them into the specified table. I think that if SQLLDR is made to read recod in the data file sequentially, this can be done.
    ANy idea of how to make SQLLDR read the records from the file sequentially?
    Thanks
    Ketha

  • Issue in Color Theme on the map with ADF geographic components

    I am facing an issue in bringing up a map using color theme .I can able to bring up a map with color themes using geographic components feature in ADF.
    The problem here is 'Edit Color Map Theme' dialog which lists Map Theme in five categories like continents,counties,countries,states_abbrev,states_names.
    we had implemented map using Color Theme based on the states_abbrev and found it was working properly.
    But after some days we found that the settings we made to work for the map no longer works and resulted in no color theme on the map being displayed on the page.
    It was found that the states_names works properly instead of states_abbrev by that time.
    But again after some days it didnt work with state_names and we revert back our code to follow state_abbrev so as to get the desired result.
    Does somebody know where is the problem and how to approach this issue?

    Quick Install is gone.
    Database repair doesn't work.
    Color coded categories is gone, and as you've discovered Theme colors are gone.
    Print to Excel is gone.
    Many desktop clients that worked with 4.2 do not work.
    It won't work with legacy devces.
    and others.... There are lots of complaints about 6.2 scattered around the forums.  Personally, the HotSync manager keeps forgetting the connections I've set, and goes to default views.
    You aren't missing much of anything, IMHO.
    WyreNut
    Post relates to: Centro (AT&T)
    Message Edited by WyreNut on 02-20-2009 12:18 PM
    I am a Volunteer here, not employed by HP.
    You too can become an HP Expert! Details HERE!
    If my post has helped you, click the Kudos Thumbs up!
    If it solved your issue, Click the "Accept as Solution" button so others can benefit from the question you asked!

Maybe you are looking for