Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Websphere CMP Custom primitive wrapper

 
Travis Zimmerman
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to implement my own wrapper of a primitive type and use it to hold data retrieved through CMP in Websphere?
I would like to retrieve a primary key column defined in Oracle 9i as a Number(20), I know this can work using standard JDBC.
Thanks for the help.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry, but I'm trying to figure out what your problem is besides the solution. What does a custom wrapper class have to do with anything? Do you just want to map a number(20) to a Long? What value would the custom wrapper class give you?
Kyle
 
Travis Zimmerman
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I tried to present a simple example to hide the complexity of what I am doing. The wrapper is actually a unique key class that needs more functionality then Long would give me.
I thought it may be possible, but I have been unable to figure out how the container would expect to get and set the values from the object. Maybe it isn't possible. I guess that is the question.
I was trying to cheat and ask before I spent a few hours messing around with examples, you seemed to have caught me.
Thanks again!
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, now we're on to something. So you just want to build a PrimaryKey class that stores its information in a long, but that maps to a primary key column that's a number(20)?
If so, then that's certainly doable...
Kyle
[ December 07, 2003: Message edited by: Kyle Brown ]
 
Travis Zimmerman
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, for the most part. The unique key could be part of a primary key class, but not all of the time. It could also be a foreign key. The value would always be a long but there are other operations that I want to associate with these specific column types.
I found the converters ( com.ibm.vap.converters.VapAbstractConverter ), and was able to successfully create one of these to do what I wanted. It all worked perfectly, however, in looking at the deployment files I am rather frightened. I am testing ways of doing things in Websphere Application Developer Studio, but actual development will be done in Eclipse and XDoclet. So I need to figure out how to get all of this stuff copied over. The mapxmi file is one that I have no idea how to do, or if it can even be generated, which would mean I I have to maintain this file by hand. This is fine for 1 table, but daunting for 100 tables. I also need to figure out what all the ibm specific files contain, the information generated from WSADS is rather cryptic.
I think I am just thinking out loud here, I guess my question now is if the Converter concept is IBM specific, is there a way to do this that will work in other application servers. Of, course any other pointers would be greatly appreciated.
Thanks again!
Travis Zimmerman
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Um, no, this will never be application server independent because mapping to a database is always a vendor-specific operation. You have to do it completely differently on all vendors because that part of J2EE development is not standardized.
Also, there is no XDoclet support for WAS 5.0 -- it exists for 4.0 but not for 5.0, so you'd not be able to use that either...
And finally, there are schemas for the ibm specific files in the WebSphere directory structure. Look under the "properties" subdirectory and I think you'll find them...
Kyle
 
Travis Zimmerman
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help, it is greatly appreciated!
Travis Zimmerman
 
Travis Zimmerman
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help, it is greatly appreciated!
Travis Zimmerman
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic