Can't read with native query a type of CHAR(2)

I'm working with mysql 5 /EJB3/JDK6
I want from a nativequery read a field of CHAR(n) in a database, when I user varchar , it s works, but if i use char(n), I always get a java.lang.Character instead of a String.
CREATE TABLE testchar(
myid CHAR(2) PRIMARY KEY
)When i user native query to retrive data then I get a java.lang.Character instead of a String.
q=em.createNativeQuery("SELECT myid FROM testchar");
q.setMaxResults(2);
List<Object[]> r= q.getResultList();
log.info("class="+ r.get(0).getClass()+" "+r.get(0));
-->return java.lang.Character and value is the first character of the row     There is someone who have an idea of what is wrong?
Thanks

the fact that you are using a native query is the first thing that is wrong. The only time you need a native query is when you want to do something database specific. IF you do something database specific, I hope you have thought deep and hard about really needing it.

Similar Messages

  • Hi guys can someone help with a query regarding the 'podcast app' why do they not have all the episodes that relate to one show available why only half or a selected amount

    Hi guys can someone help with a query regarding the 'podcast app' why do they not have all the episodes that relate to one show available why only half or a selected amount

    THanks...but some days they have all the episodes right back to the very first show...ive downloaded a few but they are only available every now and then which makes no sense...why not have them available the whole time ??

  • Is there a limit on the size of SDHC card that can be read with the iPad camera connectioin kit?

    Is there a limit on the size of SDHC card that can be read with the iPad camera connection kit?

    I've successfully connected 32 gig SDHC and CF cards so if there is an upper limit, it's at least 32 gig.
    I know SDXC will not work.
    With the cards that don't work, have they been formatted correctly? the camera connection kit will only read cards holding images. (Well, it'll only see the images) And those images have to have a file name of exactly 8 characters (DSC_2342 for example) and they  have to be in a folder named DCIM.
    Anything else it wont' read.
    I put a photo on there called 'Christmas' and the connection kit won't see it. I put a photo on there in the DCIM folder named XMAS2342 it'll see that.
    So it's possible that those cards weren't read because they weren't speaking the right language.

  • Can't work with the Query after I save a 3.5 Query in 7.0 Query Designer

    Hello,
    my Problem is, I open a 3.5 Query in a 7.0 Query Designer. Then I save as another name. When i Open the Query
    i can't change things... WHY ? A Standart Transport is OK in RSA1, Transport, BexTransport. all ok..
    can't work with the Query after I save a 3.5 Query in 7.0 Query Designer
    Best Regadrs

    Hi,
    I cant click on it. It is grey..
    I open the 3.x Query in a 7.0 Query Designer and save as another name.. Then I try to open it with the 7.0 tool. The Query is displayed. But I cant change something...
    thnx

  • Can XI work with a query or infoset in ECC?

    Hi All,
    Can XI work with a query or infoset in ECC? if it possible how can achive that?????????
    Regards

    Hi ,
    XI Cann't work directly with query or infoset . Either you can use ABAP Proxies or RFC . Which will help you
    Regards,
    Jude

  • Can't read mpeg2 natively on my mac OSX 10.7.5

    So I'm a Video Editor at a college running OSX 10.7.5 with FCP X (yuk). We use a DTE ProHD DR-HD100 (firestore) to store my footage off my JVC HD Camera. The problem is the unit records MPEG2 format for the QT record setting. I end up with hundreds of gigs for a project and running each clip thru Mpeg streamclip or such takes so much time.
    Is there a QT MPEG2 componet out yet or a easier workaround for this problem?? I need to run Mpeg2 nativley.
    Thanks in advance

    Is there a QT MPEG2 componet out yet or a easier workaround for this problem?? I need to run Mpeg2 nativley.
    Most people use the direct camcorder import option built into Apple's video editing apps (assuming the camcorder is compatible/recoggnized by the app). For instance, iMovie will import MPEG-2 video by expanding the P- and B-frames to all I-frame video—essentially turing the spatial GOP content to frame editable Motion MPEG temporal video. It also converts the non-editable AC3 audio to Linear PCM (AIFF) and merges it with the video in an MOV file container with start/end time track offsets to minimize the possibility of A/V sync problems. Once, imported in this manner, the files are edit compatible with all QT based computer apps (e.g., QT 7 Pro, QT X, GarageBand, MPEG Streamclip, etc.) on systems with recent versions of iMovie installed.

  • Can anyone help with this query

    create table customer(
    customer_email varchar(100) not null
    ,cust_id int not null
    ,constraint pk__customer primary key clustered(cust_id)
    Please help ASAP
    create table purchase (
    purchase_id int not null identity(1,1)
    ,cust_id int not null references customer(cust_id)
    ,product_name varchar(200) not null
    ,amount int not null
    ,constraint pk__purchase primary key clustered (purchase_id)
    Write a query that returns one row per customer with the following columns. Don't forget about customers with no purchases.
    customer_email
    qty of purchase
    sum of purchase amount

    Homework deadline looming?
    This will work in versions of Oracle from 9 up, and in all versions of Sybase/ SQL Server (which you seem to wnat based on the CREATE TABLE syntax).
    SELECT customer_email, COUNT(*) number_purchaes, SUM(amount) total_purchases
    FROM customer c
         LEFT OUTER JOIN purchases p ON c.cust_id = p.cust_id
    GROUP BY customer_emailTTFN
    John

  • Who can supply me with 68-pin D-type connectors?

    I'm building a custom circuit which will connect to an NI DAQ board via an SH1006868 cable. This means that the interface needs to be via a pair of 68-pin D-type connectors. However, I can't find anyone who makes or sells these. Can anyone direct me to a source? I've checked Digikey, Mouser, Newark, Amphenol and 3M...no luck.

    Hello,
    I believe you should be able to find what you need in the following Knowledge Base article.
    Specifications and Manufacturers for Board Mating Connectors
    It lists several AMP part numbers depending on whether you want verticle, right-angle etc... Let me know if you have any trouble finding something.
    I hope this helps!
    Russell
    Applications Engineer
    National Instruments
    http://www.ni.com/support

  • Who can help me with this query???

    I have a table looks like:
    Group_id, Individual_id, field1, field2, field3...
    For individuals in this table who shares the same group id, they have exact same, filed1, 2, 3, 4 but different individual_id.
    How can I comebine them so I can creat a table that looks like:
    group_id, (Individual_id1, individual_id2, 3...), field1, field2, field3....
    Please Help!

    Use the WM_CONCAT function.
    http://www.psoug.org/reference/undocumented.html#uwmc

  • ORA-19279: Query dynamic type mismatch: expected singleton sequence

    Hi,
    I have my xml stored in the table 'xml_table’
    The content of XML is a follows:
    <COMPANY NAME="ABC">
    <DEPARTMENT_NAME>Paris</DEPARTMENT_NAME>
    <ADDRESS>Rue de nevers</ADDRESS>
    <DEPARTMENT_NAME>London</DEPARTMENT_NAME>
    <ADDRESS>Northampton Square</ADDRESS>
    </COMPANY>
    I would like to query the xml to get the output like that:
    COMPANY_NAME | DEPARTMENT_NAME | ADDRESS
    ABC | Paris | rue de nevers
    ABC | London | Northampton Square
    However when I execute the query:
    SELECT t.company_name, t.address, t.department_name
    FROM xml_table p,
    XMLTable('/COMPANY' PASSING p.OBJECT_VALUE
    COLUMNS company_name PATH '@NAME',
    address VARCHAR2(100) PATH '/COMPANY/ADDRESS',
    department_name VARCHAR2(100) PATH '/COMPANY/DEPARTMENT_NAME') t
    I am getting error:
    ORA-19279: XPTY0004 - XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence
    What can be wrong with the query? Howe should it be modified to get desired output?
    Thank for help
    Groxy

    As was mentioned... Enclosing the tags for each department in a DEPARTMENT tag would make this easier and more effiecient but here's an alternative approach if modifying the XML is not an option
    SQL> with COMPANY_XML as
      2  (
      3    select XMLTYPE(
      4  '<COMPANY NAME="ABC">
      5     <DEPARTMENT_NAME>Paris</DEPARTMENT_NAME>
      6     <ADDRESS>Rue de nevers</ADDRESS>
      7     <DEPARTMENT_NAME>London</DEPARTMENT_NAME>
      8     <ADDRESS>Northampton Square</ADDRESS>
      9  </COMPANY>') as OBJECT_VALUE from dual
    10  )
    11  select R.*
    12    from COMPANY_XML,
    13         XMLTABLE
    14         (
    15            'for $COMP in $COMPANY/COMPANY
    16               for $DEPT at $DEPTIDX in $COMP/DEPARTMENT_NAME
    17                 return <RESULT>
    18                         <NAME>{fn:data($COMP/@NAME)}</NAME>
    19                         {
    20                           $COMP/DEPARTMENT_NAME[$DEPTIDX],
    21                           $COMP/ADDRESS[$DEPTIDX]
    22                         }
    23                       </RESULT>'
    24            passing OBJECT_VALUE as "COMPANY"
    25        ) r
    26  /
    COLUMN_VALUE
    <RESULT><NAME>ABC</NAME><DEPARTMENT_NAME>Paris</DEPARTMENT_NAME><ADDRESS>Rue de
    nevers</ADDRESS></RESULT>
    <RESULT><NAME>ABC</NAME><DEPARTMENT_NAME>London</DEPARTMENT_NAME><ADDRESS>Northa
    mpton Square</ADDRESS></RESULT>This above step creates a document for all tags with a particular index and then we can apply a columns cause to get the results..
    SQL>   with COMPANY_XML as
      2  (
      3    select XMLTYPE(
      4  '<COMPANY NAME="ABC">
      5     <DEPARTMENT_NAME>Paris</DEPARTMENT_NAME>
      6     <ADDRESS>Rue de nevers</ADDRESS>
      7     <DEPARTMENT_NAME>London</DEPARTMENT_NAME>
      8     <ADDRESS>Northampton Square</ADDRESS>
      9  </COMPANY>') as OBJECT_VALUE from dual
    10  )
    11  select R.*
    12    from COMPANY_XML,
    13         XMLTABLE
    14         (
    15            'for $COMP in $COMPANY/COMPANY
    16               for $DEPT at $DEPTIDX in $COMP/DEPARTMENT_NAME
    17                 return <RESULT>
    18                         <NAME>{fn:data($COMP/@NAME)}</NAME>
    19                         {
    20                           $COMP/DEPARTMENT_NAME[$DEPTIDX],
    21                           $COMP/ADDRESS[$DEPTIDX]
    22                         }
    23                       </RESULT>'
    24            passing OBJECT_VALUE as "COMPANY"
    25            columns
    26            NAME            VARCHAR(10),
    27            DEPARTMENT_NAME VARCHAR2(24),
    28            ADDRESS         VARCHAR2(24)
    29        ) r
    30  /
    NAME       DEPARTMENT_NAME          ADDRESS
    ABC        Paris                    Rue de nevers
    ABC        London                   Northampton Square
    SQL>

  • Reading parameters from Query string : Sender SOAP adapter.

    Hello Experts,
    I have a SOAP to SOAP scenario. Here we will have multiple receivers and dynamic receiver determination is needed.
    The sender will send a Value in Query string of URL to sender SOAP adapter. This value in Query string parameter will decide the receiver at runtime.
    I need to know, how can we read values from Query string of incoming call? I did tried to search blogs & forum threads but unfortunately not able to hit the right links.
    Any inputs will be of great help.
    Should i use "Use Query String" on sender soap channel? I tried it, but i was not able to find any query string parameters in SOAP header or payload.
    Please guide me, its bit urgent.
    Regards,
    Abhi.

    > But the argument provided from their side is: They are using standard XSD and this service is provided out of box with sender application.
    If they can add a URL parameter, they can also add a field to the structure.
    > They cant control the value mapping of parameters in payload to the extent required to implement this change.
    Adding a new field to the structure would not affect any existing mapping.
    > Since they have this custom requirement of multiple receivers & receiver to be determined at runtime, they need to go for Query string.
    This can be done based on any field of the payload.
    > I need to find a way to read the query string in any case.
    This is not supported by SOAP adapter.
    > Can I use one of the header parameters to be mapped to this value  (By selecting "Use Query string" & "Keep Headers" flag in sender CC) & then extract this value from header using Dynamic configuration ?
    This feature works only for XI header fields, like message ID or QoS.
    Not for individual parameters.

  • Report with multiple query

    Hi,
    I want to construct a report that consists of results from a number of different queries, I was just wondering how would acheive that if APEX only allows me to return one query?
    Thanks
    Candy

    "which tool does allow you to create one report out of multiple indipendant queries?"
    I don't know which tools allow me to do that, I was hoping there's something like that.
    The report I want to show is something like this, I have a table with a list of customers, each customer has a number of work request(an other table), where some of my team collegaues would spend X amount of time on the work request.
    the report should show something like this for the current week or month:
    company A Michael 5 hrs
    Pete 4 hrs 1 week ago 2 week ago
    total: 9 hrs 7 hrs 17 hrs
    I hope you can see what i am trying to show in my report, basically, it should show for each customer the name of the worker and the hrs he spent, and then the total, that i suppose i can do it with one query:
    select sum(wrs.time), con.first_name, c.full_name
    from customers c,
    work_request wr,
    work_request_state wrs,
    contacts con
    where wrs.request_id = wr.id
    and wr.customer_id = 27
    and c.cust_id = 27
    and wrs.time!=0
    and wrs.changed_date > trunc(next_day(sysdate -7, 'SUN'))
    and wrs.changed_by = con.cont_id
    and con.cust_id = 0
    group by con.first_name, c.full_name
    order by c.full_name;
    but i also want to find out one/two week ago, how many hours were spent, and that's when i need to do a separate query with different where clause.
    If you don't undersatnd my report, I can email the report template to you, so you can see it better in a table.
    Perhaps I just over looked the whole problem...

  • JPG files unreadable in cover flow and preview but can be read in quicktime

    After upgrading to 10.5 some jpg files (canon 30D shots) can not be shown in cover flow or preview. Also the files will not import in iPhoto (import hangs). The files can be read with quicktime.
    If I press 'get info' for the folder that contains the jpg's the Finder seems to crash, and quickly restarts.
    If I try to open the file in preview, nothing happens (while other jpg's are fine)
    If the files are transferred to another mac running 10.5 the same problem occurs
    Permissions seem to be ok
    Any suggestions?

    My problem is similar.
    Create a file in Illustrator CS3
    Open File in Photoshop CS3
    Save File as JPEG
    - Quicklook - Crashes Finder
    - Get info - Crashes Finder
    - Drag into Mail - nothing happens
    - Open in Preview - nothing happens
    - Open in Photoshop - all ok
    Workaround - Open file in photoshop and Copy and paste into a new document.
    Guess that strips out some Metadata.
    This is also what caused a Numbers.app file from opening - the document had a jpeg imported. Solved by showing package contents on the numbers file and deleting the offending jpeg.
    This is reproducible on 10.5, 10.5.1, Intel and PPC systems.

  • Can't read avi files "/usr/lib/libncurses.5.4.dylib" is missing

    I got avi files that i can't read with vlc or mplayer. the mplayer error message said that /usr/lib/libncurses.5.4.dylib is missing. i find out this is normal because i am using 10.3. but how can i get it to work? i downloaded the ncurses5.4 package on the web but i didn't manage to install it. thanks
    ibook G4   Mac OS X (10.3.9)  

    I'm having this problem too.
    I upgraded from the mplayer-1.0pre8 version and upon installing mplayerOSX-1.0rc1 whenever I try to run any of my .avi files I get this:
    2007-03-05 17:20:53.587 MPlayer OSX PPC[427] ===================== MPlayer OSX Started =====================
    2007-03-05 17:20:54.118 MPlayer OSX PPC[427] User Default Deleted
    2007-03-05 17:21:02.080 MPlayer OSX PPC[427] Path to MPlayer: /Applications/MPlayer OSX PPC.app/Contents/Resources/ExternalBinaries/mplayerppc.app/Contents/MacOS/mplayer
    2007-03-05 17:21:02.080 MPlayer OSX PPC[427] Arg: /Users/******/Movies/Random-File Name.avi
    2007-03-05 17:21:02.080 MPlayer OSX PPC[427] Arg: -identify
    2007-03-05 17:21:02.080 MPlayer OSX PPC[427] Arg: -frames
    2007-03-05 17:21:02.080 MPlayer OSX PPC[427] Arg: 0
    2007-03-05 17:21:02.080 MPlayer OSX PPC[427] Arg: -ao
    2007-03-05 17:21:02.080 MPlayer OSX PPC[427] Arg: null
    2007-03-05 17:21:02.080 MPlayer OSX PPC[427] Arg: -vo
    2007-03-05 17:21:02.080 MPlayer OSX PPC[427] Arg: null
    dyld: /Applications/MPlayer OSX PPC.app/Contents/Resources/ExternalBinaries/mplayerppc.app/Contents/MacOS/mplayer can't open library: /usr/lib/libncurses.5.4.dylib (No such file or directory, errno = 2)
    2007-03-05 17:21:02.181 MPlayer OSX PPC[427] Abnormal playback error. mplayer returned error code: 5
    I have no idea what any of this means. I get the same error after I download the Binary Codex for PowerPC and install that. I deleted all files in anyway related to mplayer, then reinstalled everything, and I get the same result. Any help would be most appreciated.
    For all the problems I've been having I wish I hadn't upgraded. Can't seem to get the old version to work anymore either.

  • How can I read a binary file stream with many data type, as with AcqKnowledge physio binary data file?

    I would like to read in and write physiological data files which were saved by BioPac�s AcqKnowledge 3.8.1 software, in conjunction with their MP150 acquisition system. To start with, I�d like to write a converter from different physiodata file format into the AcqKnowledge binary file format for version 3.5 � 3.7 (including 3.7.3). It will allow us to read different file format into an analysis package which can only read in file written by AcqKnowledge version 3.5 � 3.7 (including 3.7.3).
    I attempted to write a reader following the Application Note AS156 entitled �AcqKnowledge File Format for PC with Windows� (see http://biopac.com/AppNotes/ app156Fi
    leFormat/FileFormat.htm ). Note the link for the Mac File format is very instructive too - it is presented in a different style and might make sense to some people with C library like look (http://biopac.com/AppNotes/ app155macffmt/macff.htm).
    I guess the problem I had was that I could not manage to read all the different byte data stream with File.vi. This is easy in C but I did not get very far in LabView 7.0. Also, I was a little unsure which LabView data types correspond to int, char , short, long, double, byte, RGB and Rect. And, since it is for PC I am also assuming the data to be written as �little endian� integer, and thus I also used byte swap vi.
    Two samples *.acq binary files are attach to this post to the list. Demo.acq is for version 3.7-3.7.2, while SCR_EKGtest1b.acq was recorded and saved with AcqKnowledge 3.8.1, which version number is 41.
    I would be grateful if you someone could explain how to handle such binary file stream with LabView and send an example to i
    llustrate it.
    Many thanks in advance for your help.
    Donat-Pierre
    Attachments:
    Demo.acq ‏248 KB
    SCR_EKG_test1b.acq ‏97 KB

    The reading of double is also straight forward : just use a dble float wired to the type cast node, after inverting the string (indian conversion).
    See the attached example.
    The measure of skin thickness is based on OCT (optical coherent tomography = interferometry) : an optical fiber system send and received light emitted to/back from the skin at a few centimeter distance. A profile of skin structure is then computed from the optical signal.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Read_AK_time_info.vi.zip ‏9 KB

Maybe you are looking for

  • How can I center a symbol on a responsive page created with adobe edge ?

    Hi everybody ! I started working on Adobe Edge Animate for about 1 month now, it's a great tool for a young web designer like me. Actualy, I'm working on my responsive personal website and I encountered some problems. When I create a new symbol and t

  • Rocketfish adapter not working with MacBook Pro 13 inch

    I have a rocketfish HDMI to mini displayport adapter. I have tried to connect it to a 22 inch monitor and a 50 inch TV as an extended monitor but the MacBook does not recognize the extended display. Any ideas on how to resolve or is the adapter not s

  • Characteristics in the material master (SAP Retail)

    Hi everybody, Iu2019m using SAP Retail and I need to maintain characteristics in the material master. These characteristics are used to maintain additional information like u201Caccessoriesu201D and u201Cguaranteeu201D (Iu2019m not working with gener

  • Email with worklfow problem text is broken in middle.

    HI , I have a problem as described below: Requirement. To send Email notification using workflow . I am using the standard method <i>SENDTASKDESCRIPTION</i> of BOR object <i>SELFITEM</i> in the task . while passing the text in the email i have a url

  • Add PayPal Button to basic form on submit?

    I have a page at http://www.canlaw.com/domains/post.html which permits people to pay by paypal But I do not see how to combine paypal with a simple submit button when filling out a form Suggestions? Thanks Kirby