Toplink JPA and Java type mapping

Hi there,
I'm struggling wit mapping an existing database using Toplink Essentials.
Specifically: I have an INT SQL field which I want to map as boolean/Boolean in my entity class.
How to do this? Either in standard JPA or with some Toplink extensions?
Markus

Hi Markus,
The JPA spec doesn't cover conversion/transformation but you can do it with TopLink Essentials using a Converter. I have an example pasted below that uses a converter to map between a database VARCHAR value and a pre-Java 5 enum (i.e., a hand coded enum-type class that runs in Java 1.4).
I use a descriptor customizer to get hold of the Basic mapping (in TopLink a "DirectToFieldMapping") and then plug in a converter.
--Shaun
Persistence.xml:
<property
   name="toplink.descriptor.customizer.TypeWriter"
   value="oracle.toplink.essentials.emf.examples.library.orm.TypeWriterCustomizer"/>The customizer:
public class TypeWriterCustomizer implements DescriptorCustomizer {
      * Add customizer to translate between Enum and value.
     public void customize(ClassDescriptor descriptor) throws Exception {
          DirectToFieldMapping typeMapping = (DirectToFieldMapping) descriptor.getMappingForAttributeName("type");
          Converter typeWriterEnumConverter = TypeWriterEnumConverter.getInstance();
          typeMapping.setConverter(typeWriterEnumConverter);
}The actual converter class:
* TypeWriterEnumConverter is a singleton since it has no state.
public class TypeWriterEnumConverter implements Converter {
     protected static TypeWriterEnumConverter instance = new TypeWriterEnumConverter();
     private TypeWriterEnumConverter() {}
     public static TypeWriterEnumConverter getInstance() {
          return instance;
     public Object convertDataValueToObjectValue(Object data, Session session) {
          String typeName = (String)data;
          return TWriterType.get(typeName);
     public Object convertObjectValueToDataValue(Object object, Session session) {
          TWriterType type = (TWriterType) object;
          if (type != null) {
               return type.getName();
          } else {
               return null;
     public void initialize(DatabaseMapping arg0, Session arg1) {}
     public boolean isMutable() {
          return false;
}

Similar Messages

  • Toplink JPA and handle to a sequence

    Hi All,
    I am trying to figure out a way to get a handle to an Oracle sequence and use it from the java application i.e. run operations like currval/nextval.
    The reason I need this flexibility is to refer 2 sequences from the java app and apply it on a single table. Currently the table i am trying to insert already has a sequence which is a primary key generator. We do refer it in our JPA annotations and this works fine.
    But there was a need where another column (not part of Primary key) also needs its values from a different sequence.
    When we try to refer it from Toplink JPA it does not allow and errors stating cannot have 2 sequences mapping for a single table entity.
    Let me know your thoughts.
    Thanks

    You could use a native SQL query to get the nextval or curval from the Sequence.
    TopLink/EclipseLink should support an API for this, or allow multiple sequences per object, please vote for these bugs,
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=267701
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=320456
    James : http://www.eclipselink.org

  • Toplink-jpa and/or jdev11 problem

    Hi,
    How should I configure a toplink/jpa application in oc4j 11? Mine doesn't seem to be able to be able to connect... But I guess I didn't configure correctly.
    Anyway, it works in the jdevelopper 11 (technical preview) embedded oc4j. I can deploy it ok from jdeveloper, and even connect to the session beans on the server from another application (swing client, independant).
    But whenever my beans try to make a request, I get this exception:
    exception occurred during method invocation:
    javax.ejb.EJBTransactionRolledbackException: Exception [TOPLINK-4002] (Oracle
    TopLink - 11g Release 1 (11.1.1.0.0) (Build 070428)):
    oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish
    the connectionError Code: 17002; nested exception is: Exception [TOPLINK-4002]
    (Oracle TopLink - 11g Release 1 (11.1.1.0.0) (Build 070428)):
    I made a sample jdbc connection from the session bean, to the database it should connect to: no problem.
    Is there a checklist of what I should make sure? There are a lot of wizards, configuration files, etc. and I'm a little bit confused about the cause of the problem and how to fix it. My question has been on metalink for 48 hours, but without luck yet.
    Here is a more complete part of the stack trace:
    Caused by: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:72)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:105)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:168)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:224)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:495)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:429)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:650)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:200)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:413)
    at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:388)
    at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:278)
    at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:203)
    at oracle.oc4j.sql.DataSourceConnectionPoolDataSource.getPooledConnection(DataSourceConnectionPoolDataSource.jav
    a:57)
    at oracle.oc4j.sql.xa.EmulatedXADataSource.getXAConnection(EmulatedXADataSource.java:94)
    at oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createXAConnection(ManagedConnectionFactoryImpl.java:251)
    at oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createManagedConnection(ManagedConnectionFactoryImpl.java:21
    2)
    at com.evermind.server.connector.ApplicationConnectionManager.createManagedConnection(ApplicationConnectionManager.java:1354)
    at oracle.oc4j.sql.OracleConnectionFactoryAdapter.createConnection(OracleConnectionFactoryAdapter.java:110)
    at oracle.ucp.common.CollectionConnectionPoolImpl.createOnePooledConnection(Coll
    ectionConnectionPoolImpl.java:513)
    at oracle.ucp.common.CollectionConnectionPoolImpl.borrowConnectionWithoutCountingRequests(CollectionConnectionPoolImpl.java:
    419)
    at oracle.ucp.common.CollectionConnectionPoolImpl.borrowConnection(CollectionConnectionPoolImpl.java:295)
    at oracle.oc4j.sql.OracleCommonConnectionPool.borrowConnection(OracleCommonConnectionPool.java:79)
    at oracle.oc4j.sql.OracleCommonConnectionPool.getManagedConnection(OracleCommonConnectionPool.java:61)
    at oracle.j2ee.connector.OC4JConnectionPoolAdapter.getManagedConnection(OC4JConnect
    ionPoolAdapter.java:543)
    at com.evermind.server.connector.ApplicationConnectionManager.getManagedConnectionContext(ApplicationConnectionManager.java:1568)
    at com.evermind.server.connector.ApplicationConnectionManager.getConnectionFromPool
    (ApplicationConnectionManager.java:1553)
    at com.evermind.server.connector.ApplicationConnectionManager.acquireConnectionContext(ApplicationConnectionManager.ja
    va:1499)
    at com.evermind.server.connector.ApplicationConnectionManager.allocateConnection(ApplicationConnectionManager.java:1444)
    at oracle.j2ee.connector.OracleConnectionManager.unprivileged_allocateConnection(OracleConnectionManager.jav
    a:238)
    at oracle.j2ee.connector.OracleConnectionManager.allocateConnection(OracleConnectionManager.java:192)
    at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:217)
    at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:147)
    at oracle.toplink.jndi.JNDIConnector.connect(JNDIConnector.java:123)
    ... 69 more

    HI
    can you reply the feedback of metalink? because I'm having similar problem.
    I debug in junit and embebbed at the jdev and it works well, but when I deploy in a standalone oc4j it gives me the same error of Excepção de E/S: The Network Adapter could not establish the connection
    And I'm not using 11g, I'm still in 10g but the problem might be the same.
    cumps
    DnlCY
    null

  • Attachment to Java type mapping

    I want to create a web services to receive quite big portion of information. So I defined my method as:
    @WebService
    public class Infolet {
        public long run(String name, String enterprise, InputStream instream) throws RunException {
          printStreamContent(instream);
          return 1;
        }wsgen creates wsdl with abstract class InpputStream, so obviousy I can't use a real input stream in my client code matching to this parameter. So what's solution?

    Dave,
    What docs are you looking at? http://docs.solarmetric.com/sql_types.html
    seems to have the complete table.
    -Patrick
    On Sun, 22 Jun 2003 15:44:43 -0600, Dave Ford wrote:
    I am looking at the Kodo manual. And there is table that says:
    "Following is a table of the java class to SQL type that is generated by the
    schematool."
    The problem is, I didn't see any java types.
    Where can I find a table that states the sql types that correspond to java
    types.
    Dave Ford
    Smart Soft - The Developer Training Company
    http://www.smart-soft.com
    Patrick Linskey
    SolarMetric Inc.

  • Java Type mapping of NUMBER columns

    I'm using JDBC Oracle driver 10.2.0.4, with java 1.5 and Oracle 10.2.0.4.
    Reading a field of NUMBER(6) JDBC driver map it to java.lang.Integer, if I extend this column to NUMBER(9) Jdbc map it to java.lang.Long.
    When can I find a detailed documentation of Number mapping, i found some documentation for general field mapping but is not exhaustive about NUMBER fields and this behavior is not documented.
    Thanks
    Carlo

    That is all database/driver specific. So you have figure it out using what is in the Oracle java classes. There is no generic jdbc solution. If you are lucky the Oracle docs for the driver might document something useful.
    If it was me I would just wrap another proc around it and have that strip the fields out for me and return it as a regular result set.

  • XMl and Java object mapping

    I need to map java objects with XMl Node or XML Elements.
    My java objets get some attributes, for instance name,color ...
    and i need an output like:
    <OBJECT_OF_TYPE_XXX>
    <NAME>scott</NAME>
    <COLOR>red</COLOR>
    </OBJECT_OF_TYPE_XXX>
    Any idea?
    Thanks
    Maurice

    You can try JAXB which includes a compiler that generates classes based on the XML Schema for your xml structure. It also features the possibility to convert between xml and the generated objects.
    Take a look at chapter 9 and 10 at http://java.sun.com/webservices/docs/1.1/tutorial/doc/index.html

  • Linux and Java sound - map mixers to devices

    Hi,
    I have a question regarding Java Sound API and Linux. I need to query a list of sound devices and let the user choose one of them for further audio operations. This works using the
    AudioSystem.getMixerInfo()call. However, the names of the mixers are not very useful. I find the following mixers:
    Intel [plughw:0,0], version 1.0.23
    Intel [plughw:0,2], version 1.0.23Is there a way to get better names, similar to what Gnone or KDE sound panels display?
    When I run the same code under Windows, the output is much better.

    Try the code from the following article:
    http://www.developerfusion.com/article/84314/wired-for-sound/

  • Toplink JPA LAZY loading in Java SE works without javaagent?

    hi there,
    I tought that mappings like
    @JoinColumn(name = "join_col_name")
    @ManyToOne(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    private RelatedObject relObj;
    with TopLink JPA in Java SE environment works ONLY with the
    -javaagent:toplink-essentials-agent.jar
    JVM parameter?
    the strange thing is: I did 2 test runs, with and without the java agent parameter. I also could see that in the first case the weaver is working, in the second the property "toplink.weaving=false" is printed to the console BUT if I access the LAZY mapped attribute of the object instance it works in both cases - I expected a NullPointerEx. in the case without the javaagent.
    Is there anything I missed?
    Hans

    Chris,
    thank for for the tip about verifying lazy or eager fetching. The results are interesting - or better: confusing - to me:
    I have built a test project with 3 entities:
    Entity A hast @OneToMany to Entity B and
    Entity B has ManyToONe to Entity C
    A <-- B --> C
    ALL relations are marked with FetchType.LAZY in all directions.
    When I simply run the test project via main()-method out of eclipse, WITHTOUT specifycing a -javaagent parameter in the run dialog, I can confirm using your test case that the realtion IS LAZILY FETCHED.
    So, I do not really know how this should work without the javaagent.
    You mentioned statically weaved classed - is this the default case when no agent is present, how is it done? Toplink logging says that weaving is NOT active:
    ServerSession(16821027)--Thread(Thread[main,5,main])--property=toplink.weaving; value=false
    so how can the lazy loading work then?
    regards,
    Hans

  • Type mapping Oracle/Java

    Where can I find a mapping chart between Oracle and Java types?
    Thanks,
    Jean-Philippe Doucet

    http://java.sun.com/products/jdk/1.1/docs/guide/jdbc/getstart/mapping.doc.html

  • Toplink JPA with Coherence deployment to Weblogic 10.3

    Hi,
    I have created an EJB application using Toplink JPA and Coherence. I would like to deploy this application to Weblogic 10.3.
    During the startup of Weblogic I have specified the Java option as
    -Dtangosol.coherence.cacheconfig=D:/JDEV_11g/jdeveloper/jdev/mywork/CoherenceApp/CoherenceProject/src/META-INF/coherence-cache-config.xml.
    Persistence.xml and coherence-cache-config.xml are palced inside the jar file.
    When I execute the ejb client program, during the method call, I can see that coherence is started but it uses the cache-config from the coherence.jar file instaed of the value I have set during startup. How can I make weblogic use my cache-config.xml? I have included the log file entries from server:
    [EL Finest]: 2009.04.17 05:33:48.625--UnitOfWork(1777337)--Thread(Thread[[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Execute query ReadObjectQuery(coherenceproject.MetadataType)
    2009-04-17 05:33:54.547/258.954 Oracle Coherence 3.4.2/411 <Info> (thread=[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded operational configuration from resource "zip:D:/JDEV_11g/jdeveloper/jdev/mywork/CoherenceApp/lib/coherence.jar!/tangosol-coherence.xml"
    2009-04-17 05:33:54.562/258.969 Oracle Coherence 3.4.2/411 <Info> (thread=[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded operational overrides from resource "zip:D:/JDEV_11g/jdeveloper/jdev/mywork/CoherenceApp/lib/coherence.jar!/tangosol-coherence-override-dev.xml"
    2009-04-17 05:33:54.562/258.969 Oracle Coherence 3.4.2/411 <D5> (thread=[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Optional configuration override "/tangosol-coherence-override.xml" is not specified
    2009-04-17 05:33:54.578/258.985 Oracle Coherence 3.4.2/411 <D5> (thread=[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Optional configuration override "/custom-mbeans.xml" is not specified
    Oracle Coherence Version 3.4.2/411
    Grid Edition: Development mode
    Copyright (c) 2000-2009 Oracle. All rights reserved.
    *2009-04-17 05:33:55.750/260.157 Oracle Coherence GE 3.4.2/411 <Info> (thread=[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded cache configuration from resource "zip:D:/JDEV_11g/jdeveloper/jdev/mywork/CoherenceApp/lib/coherence.jar!/coherence-cache-config.xml"*
    2009-04-17 05:34:17.390/281.797 Oracle Coherence GE 3.4.2/411 <D5> (thread=Cluster, member=n/a): Service Cluster joined the cluster with senior service member n/a
    2009-04-17 05:34:21.890/286.297 Oracle Coherence GE 3.4.2/411 <Info> (thread=Cluster, member=n/a): Created a new cluster "cluster:0x2FFB" with Member(Id=1, Timestamp=2009-04-17 05:34:09.203, Address=141.144.90.113:8088, MachineId=18289, Location=site:sg.oracle.com,machine:rajerama-sg,process:3816, Role=WeblogicServer, Edition=Grid Edition, Mode=Development, CpuCount=2, SocketCount=1) UID=0x8D905A7100000120B0D9DD3347711F98
    2009-04-17 05:34:27.000/291.407 Oracle Coherence GE 3.4.2/411 <D5> (thread=DistributedCache, member=1): Service DistributedCache joined the cluster with senior service member 1
    [EL Finer]: 2009.04.17 05:34:28.343--ServerSession(32927169)--Thread(Thread[[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Coherence(MetadataType)::Get: 2
    [EL Fine]: 2009.04.17 05:34:28.703--ServerSession(32927169)--Thread(Thread[[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Coherence(MetadataType)::Get: 2 result: null
    [EL Finer]: 2009.04.17 05:34:28.703--ServerSession(32927169)--Thread(Thread[[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Coherence(MetadataType)::Get: 2
    *[EL Fine]: 2009.04.17 05:34:28.703--ServerSession(32927169)--Thread(Thread[[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Coherence(MetadataType)::Get: 2 result: null*
    null
    Eventhough the method is called correctly, it does not return the value. Is there any other setup that has to be done?
    Regards
    Raji

    Hi Raji,
    You mentioned:
    >
    -Dtangosol.coherence.cacheconfig=D:/JDEV_11g/jdeveloper/jdev/mywork/CoherenceApp/CoherenceProject/src/META-INF/coherence-cache-config.xml
    >
    and
    >
    Persistence.xml and coherence-cache-config.xml are palced inside the jar file.
    >
    It appears that these are conflicting; as the system property indicates that the config should be read from a file, whereas the file is actually deployed in a jar.
    That being said, I would suggest double checking that the system property is actually being set in the JVM. In my testing, if I specify a cache config that does not exist, an exception will be thrown:
    java -Dtangosol.coherence.cacheconfig=foo.xml  com.tangosol.net.CacheFactory
    Oracle Coherence Version 3.4.2/411p3
    Grid Edition: Development mode
    Copyright (c) 2000-2009 Oracle. All rights reserved.
    Map (?): cache test
    2009-04-22 15:33:15.310/6.917 Oracle Coherence GE 3.4.2/411p3 <Error> (thread=main, member=1):
    (Wrapped: Failed to load the factory) java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
            at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:662)
            at com.tangosol.net.CacheFactory.getConfigurableCacheFactory(CacheFactory.java:602)
            at com.tangosol.coherence.component.application.console.Coherence.doCache(Coherence.CDB:9)
            at com.tangosol.coherence.component.application.console.Coherence.processCommand(Coherence.CDB:209)
            at com.tangosol.coherence.component.application.console.Coherence.run(Coherence.CDB:39)
            at com.tangosol.coherence.component.application.console.Coherence.main(Coherence.CDB:3)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at com.tangosol.net.CacheFactory.main(CacheFactory.java:1308)
    Caused by: (Wrapped: Failed to load configuration resource: foo.xml) java.io.IOException: Configuration is missing: "foo.xml", loader=null
            at com.tangosol.net.DefaultConfigurableCacheFactory.loadConfigAsResource(DefaultConfigurableCacheFactory.java:386)
            at com.tangosol.net.DefaultConfigurableCacheFactory.loadConfig(DefaultConfigurableCacheFactory.java:337)
            at com.tangosol.net.DefaultConfigurableCacheFactory.loadConfig(DefaultConfigurableCacheFactory.java:309)
            at com.tangosol.net.DefaultConfigurableCacheFactory.<init>(DefaultConfigurableCacheFactory.java:137)
            ... 15 moreThanks,
    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);
    }

  • TopLink JPA  coherence

    we are using Toplink, JPA and coherence.
    can anyone point me to java code that depicts "How to warm up the coherence cache and then run queries against the cache. and then what happens if the at some point object is not in cache " ?
    thx
    D

    Warming the cache for a TopLink Grid enabled entity can be done by issuing a query for the objects you want to load into the cache along with the hint:
    query.setHint(QueryHints.QUERY_REDIRECTOR, new IgnoreDefaultRedirector());
    Which is discussed here: http://download.oracle.com/docs/cd/E14571_01/doc.1111/e16596/tlcgd003.htm#CHDGFCAI.
    You can also use JOIN and BATCH hints on the query if you want to load a graph of objects into the grid.
    With Grid Read and Grid Entity configurations all queries will be executed on the grid. Primary key queries on the grid for objects not present in the grid will result in a primary key select on the database if you've configured a CacheStore for a given entity's cache.
    Non-PK queries will only return what is in the grid. With Grid Read and Grid Entity is it your responsibility to ensure the grid is warmed up.
    --Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Java-wsdl-mapping file with incorrect case

    Hi. We're working with JDeveloper 10.1.3.1 preview and have encountered what I believe to be a bug. We have a schema with element names that are mixed case (such as FirstName). We are trying to use JAXB to create our classes and then wrap it as a web service. The problem is, the WSDL and java-wsdl-mapping file references the element names as firstName rather than FirstName.
    In experimenting, I've learned that if I create the WSDL and schema first and "Create Java Project from WSDL" that it creates a java-wsdl-mapping file with the case preserved. However the first time I go into the web services properties dialog and click OK, it re-creates these files with the case changed again.
    Please advise if this is expected behavior...although I don't see how it could be since it is inconsistent.
    Thanks very much,
    Richard Davis

    I was told the product manager and/or developers from Oracle watched this board. Doesn't anyone have a response to this?

  • The JNI defines a mapping of Java types and native (C/C++) types.

    As per the tutorial
    The JNI defines a mapping of Java types and native (C/C++) types.Does the above sentence mean that I can use dll written in C/C++ only and not dll written in Pearl.
    Could anyone please give me the solution.

    Please do tell me how can I call a dll file created in Perl ....And I will point out again that I doubt that it is possible to create a dll that has the following characteristics
    1. Is in fact a dll.
    2. Is in fact intended to run anywhere outside of the perl engine.
    Step 2 means that you run perl, not a "perl dll" via C.
    You can do that or at least in the past you could. And that has nothing to do with java nor JNI. So you would learn about it on a perl site.
    And I can only note that when I did that a number of years ago it was very difficult. Certainly much harder than getting JNI to work. And you had better have quite a bit of C/C++ experience before you attempt it.

  • JPA - Columns to java.util.Map

    I need to map the columns of a DB table into a java.util.Map object.
    Any idea about how to implement this feature?
    These are the columns of my table:
       | ID | Value01 | Value02 | Value03 | ... | ValueN |I'd like to obtain a bean like this:
    public class MyBean {
      private String ID;
      private Map values;
    }I thought I could extend java.util.Map and redefine the get(Object) and put(Object, Object) methods
    (I did something like this in java 1.4) but I can't figure it out in 1.5 with JPA

    >
    hi i have the following method,when i click my button am geting this error java.lang.String cannot be cast to java.util.Map
    >
    And that is correct - you can't do that cast. Which is what this code is trying to do.
    >
    (Map)actionEvent.getComponent().getAttributes().get("test")
    >
    Ask yourself what object is supposed to be the 'Map' in that line of code?
    Is it 'actionEvent', 'getComponent()' or 'getAttributes()'?
    My guess is that it is the 'getAttributes' that returns a map. Which means you need to cast
    actionEvent.getComponent().getAttributes()as a Map. Which means you need to put that entire thing in parentheses so that the cast is performed on it. And then you have to put THAT entire thing in parentheses so you can call the 'get' method on it.
    So this is the 'Map'
    (Map) (actionEvent.getComponent().getAttributes())And this calls the Maps 'get' method
    ( (Map) (actionEvent.getComponent().getAttributes()) ).get("test")If you broke the line into pieces and stored each piece in its own variable you would see it. These object types may not be right but should give you the idea.
    //( (Map) (actionEvent.getComponent().getAttributes()).get("test") ).get("test")
    MyComponent myComponent = (MyComponent) actionEvent.getComponent();
    Map myMap = (Map) myComponent.getAttributes();
    myMap.get("test");

Maybe you are looking for

  • Change GL account to open intem management

    Hi, We are going to change a GL account to open item management. We need a program that changes all prevously posted items ( non open item management ) to open item management. If anyone knows such a program ( standard or customer's ), I'll be glad t

  • Line Chart in Apex

    Is it possible to change color of line graph based on a condition? I want to show red if the line passes above 90 percent and then show green when the line drops below 90 percent. Can someone help me on this?

  • ISync can't connect anymore to my N70

    Hi, I have always sync my N70 via bluetooth and iSync, but since some days iSync can't connect. After I click on "Sync", iSync try to connect without sending me errors. But I can send or receive files via bluetooth!! Please help me!

  • Weird keylistener problem...

    I just upgraded my java to 1.4.2 which caused this problem i believe. I add an action listener with the following code:     this.addKeyListener(new java.awt.event.KeyAdapter() {       public void keyPressed(KeyEvent e) {         main_keyPressed(e);  

  • Photoshop freezes after new installation.

    I have a PC with windows 7. I have had photoshop on here for a year or so with no problems. I recently reformatted my PC and now for some reason when I open photoshop after it has finished installing, the grey window opens and just freezes. ive tried