*
The moose likes JDBC and the fly likes contents of Map Object in setTypeMap? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "contents of Map Object in setTypeMap?" Watch "contents of Map Object in setTypeMap?" New topic
Author

contents of Map Object in setTypeMap?

Raj Chila
Ranch Hand

Joined: Mar 18, 2004
Posts: 128

Hi all,

I wonder if some one could give me a quick intro to what the Map Objects keys and corresponding values should be?

I have some proprietory Datatypes, in a proprietory Persistence Framework, and we have to depend on reflection to convert the type to "JDBC type" at runtime. I think we dont have to do this if we can set the TypeMap at the time of the Creation of the connection. so any Idea of how to create the Map?

the getTypeMap returns an Empty map, and the javadoc says it will be empty till we set something to it.

any hints would be welcome.

Thanks in advance
Raj Chila
Ranch Hand

Joined: Mar 18, 2004
Posts: 128

Hi all,

I think I found a resource on this. thought it would be worthwhile to share it. we need to specify the key as a String, and then the type that we provide as the value should implement the SQLData Interface and put the pair into the Map...I noted that the JDBC specs suggest not to set a new Map Onject whic could possibly over write the existing mappings, rather to get the reference of the map through the getTypeMap and then add the new mappings to it and then set the type mapping to the connection using the setTypeMap method.

Hope this is informative to those interested.

Thanks any way...
Raj Chila
Ranch Hand

Joined: Mar 18, 2004
Posts: 128

Adding to the previous post...
...The above mentioned type mapping works only for the types that are defined in the database ( some user Defined Datatype... for example "Address" Type) and the key name has to be one that is defined in the database ("schemaname.type")
This is not what I was looking for...so I guess we still have to look for a way to convert the Persistence Layer Datatypes to the SQL types.

so back to where I started
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30068
    
149

RajaniKanth,
I don't know the answer to your question, but it I found your posts interesting to read.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: contents of Map Object in setTypeMap?
 
Similar Threads
Selecting a directory instead a file
Threads and serialization
problem with return type map
java upgrade makes modal dialog lock up application
can i add any type of collection to Collection<Instrument>