ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Supported Java Return Type

Post new topic  Reply to topic
 Supported Java Return Type « View previous topic :: View next topic » 
Author Message
goffinf
PostPosted: Thu Feb 21, 2008 11:45 am    Post subject: Supported Java Return Type Reply with quote

Chevalier

Joined: 05 Nov 2005
Posts: 401

I have a Java method that has an int return type. When I try to call it from eSQL I get an error which suggests that int is not supported. I can see in MB help that the eSQL INTEGER type corresponds to a Java Long, but I didn't see anything for int.

What eSQL type can I use for this ? Do I have to change the Java function to return a Long and match this on the eSQL side with INTEGER ??

Thanks

Fraser.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Feb 21, 2008 11:57 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You can return either a Long or an Integer, not an int.

I.e. you must return an object, not a primitive.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
goffinf
PostPosted: Thu Feb 21, 2008 4:15 pm    Post subject: Reply with quote

Chevalier

Joined: 05 Nov 2005
Posts: 401

Thanks Jeff.

I tried using Long and that was fine. Couldn't get Integer to cooperate though. This was the error message :-

( WBRK6_DEFAULT_BROKER.default ) The Java method ''com.aviva.nui.cv.misctests.rcInteger.rcTest'' was found but its return type does not match the ESQL return type

This was the eSQL and Java :-

DECLARE ErrorID CHARACTER;

SET ErrorID = InputRoot.XMLNSC.CheckErrorIDInRange.ErrorID;

DECLARE retCode INTEGER;

-- Hmmm Integer version doesnt work - Long does though ?
SET retCode = rcIntegerTest(ErrorID);

CREATE FUNCTION rcIntegerTest(IN ErrorID CHARACTER)
RETURNS INTEGER LANGUAGE JAVA EXTERNAL NAME "com.aviva.nui.cv.misctests.rcInteger.rcTest";


public class rcInteger {

public static Integer rcTest(String arg1){

return new Integer(42);

}
}
Back to top
View user's profile Send private message
mgk
PostPosted: Fri Feb 22, 2008 1:54 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

If you read to docs you will see that ESQL integer maps to Java Long (object) as ESQL integers are 64bit (so may overflow a Java Integer(32bit)which is why this type is not used). Also ESQL datatypes can be null so cannot map to java primitives as they cannot be null.


Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
mgk
PostPosted: Fri Feb 22, 2008 1:54 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

If you read to docs you will see that ESQL integer maps to Java Long (object) as ESQL integers are 64bit (so may overflow a Java Integer(32bit)which is why this type is not used). Also ESQL datatypes can be null so cannot map to java primitives as they cannot be null.


Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
goffinf
PostPosted: Fri Feb 22, 2008 2:14 am    Post subject: Reply with quote

Chevalier

Joined: 05 Nov 2005
Posts: 401

Ahh I see, thanks, that makes it doublely clear

Fraser.
Back to top
View user's profile Send private message
mgk
PostPosted: Fri Feb 22, 2008 4:33 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642



Sorry for the double post reply, not sure what happened there!
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Supported Java Return Type
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.