Can't map Booleans from native SQL queries with Code First, EF 6, ODAC 12c R3 (Beta 2)
We're using Code First, EF 6, ODAC 12c R3 (Beta 2). When I use LINQ-to-Entities, I can map NUMBER(1) to Boolean fields as documented here: https://docs.oracle.com/cd/E56485_01/win.121/e55744/entityDataTypeMapping.htm#ODPNT8300
<oracle.manageddataaccess.client>
<version number="*">
<edmMappings>
<edmMapping dataType="number">
<add name="bool" precision="1"/>
<add name="byte" precision="3" />
<add name="int16" precision="4" />
<add name="int32" precision="9" />
<add name="int64" precision="18" />
</edmMapping>
</edmMappings>
</version>
</oracle.manageddataaccess.client>
So far, so good:
[Table("USER_PROFILE")]
public class UserProfile
[Key]
[Column("LOGIN_ID", Order = 1)]
public string LoginId { get; set; }
[Column("IS_SUPER_USER")]
public bool? IsSuperUser { get; set; }
var query = db.UserProfiles.Take(20);
However, when I try to map to the same class from native SQL, I get an exception:
// The real query is much more complex. This is just an example.
private const string AllProfilesSql = @"
SELECT login_id AS LoginId, is_super_user AS IsSuperUser
FROM user_profile
var query = db.Database.SqlQuery<UserProfile>(AllProfilesSql).Take(20);
>The 'IsSuperUser' property on 'UserProfile' could not be set to a 'System.Int16' value. You must set this property to a non-null value of type 'System.Boolean'.
Do you know any solutions or workarounds for this? Is it a bug?
Hmm, a feature request is possible; however, I'm not sure how feasible it would be to implement (if it is possible at all) in this scenario.
The challenge is that when using SqlQuery like this, EF calls into our override of the ExecuteDbDataReader method in OracleCommand (via System.Data.Common.DbCommand.ExecuteReader). That in and of itself is not an issue it's just that we don't know that this call is from EF and so we should use the EDM mappings from the configuration. In a "normal EF" scenario we know the call is from an EF "source" so can respond accordingly and perform the mapping.
Similar Messages
-
Guys i am using Entity Framework 5 code first (I am not using edmx) with Oracle and all works good, Now i am trying to get data from stored procedure which is under package but stored procedure have out param which is user define type, Now my question is
how i will call stored procedure from entity framework
Thanks in advance.I agree with you, but issue is we have lots of existing store procedure, which we need to call where damn required. I am sure those will be few but still i need to find out.
If you think you are going to get existing MS Stored Procedures or Oracle Packages that had nothing to do with the ORM previously to work that are not geared to do simple CRUD operations with the ORM and the database tables, you have a rude awakening
coming that's for sure. You had better look into using ADO.NET and Oracle Command objects and call those Oracle Packages by those means and use a datareader.
You could use the EF backdoor, call Oracle Command object and use the Packages, if that's even possible, just like you can use MS SQL Server Stored Procedures or in-line T-SQL via the EF backdoor.
That's about your best shot.
http://blogs.msdn.com/b/alexj/archive/2009/11/07/tip-41-how-to-execute-t-sql-directly-against-the-database.aspx -
How can i return object from oracle in my java code using pl/sql procedure?
How can i return object from oracle in my java code using pl/sql procedure?
And How can i returned varios rows fron a pl/sql store procedure
please send me a example....
Thank you
nullyes, i do
But i can't run this examples...
my problem is that i want recive a object from a PL/SQL
//procedure callObject(miObj out MyObject)
in my java code
public static EmployeeObj callObject(Connection lv_con,
String pv_idEmp)
EmployeeObj ret = new EmployeeObj();
try
CallableStatement cstmt =
lv_con.prepareCall("{call admin.callObject(?)}");
cstmt.registerOutParameter(1, OracleTypes.STRUCT); // line ocurr wrong
//registerOutParameter(int parameterIndex, int sqlType,String sql_name)
cstmt.execute();
ret = (EmployeeObj) cstmt.getObject(1);
}//try
catch (SQLException ex)
System.out.println("error SQL");
System.out.println ("\n*** SQLException caught ***\n");
while (ex != null)
System.out.println ("SQLState: " + ex.getSQLState ());
System.out.println ("Message: " + ex.getMessage ());
System.out.println ("Vendor: " + ex.getErrorCode ());
ex = ex.getNextException ();
System.out.println ("");
catch (java.lang.Exception ex)
System.out.println("error Lenguaje");
return ret;
Do you have any idea? -
How can I STOP Firefox from being a glutton with my virtual memory?
How can I STOP Firefox from being a glutton with my virtual memory?
Yes. But, I see from the THOUSANDS of responses here concerning Firefox memory issues that other people have had no more success than I have at trying to STOP Firefox's memory gluttony. The fact that Firefox runs fine (like the good old days) for a while after re-booting and registry cleaning shows that something is going on beyond the trivial/ineffective suggestions offered in the referenced links.
Having to re-boot several times a day to get Firefox out of the molasses is such a pain, that it's no wonder people are going back to IE, or like me, reluctantly relying more and more on Google Chrome. -
i need more storage but every time i try to buy it says payment method declined however i can buy any app from the app store with the same method
Make sure there is enough funds for storage. Contact your bank and verify they are not stopping transaction.
-
Can´t publich websites from Lightroom 5 (works with version 4)
Hi, I use Lightroom 5 to create websites for my sports photos. The problem is that since upgrading to version 5 (5.7) I always get a error message so I have to export my photos and then publich from Lightroom version 4. Any one know what the problem might be?
Hi, thanks for respond. And yeah it is the same subfolder and everything is
exactly the same, my thought was that you maybe didnt have upgraded for
newer versions or something like that.. any ideas?
MIcke
Från: john beardsworth
Skickat: den 20 februari 2015 22:02
Till: Mikael Wiklund
Ämne: Can´t publich websites from Lightroom 5 (works
with version 4)
Can´t publich websites from Lightroom 5 (works with version 4)
created by john beardsworth
<http://t.signalequattro.com/e1t/c/5/f18dQhb0S7lC8dDMPbW2n0x6l2B9nMJW7t5XZs6
4JdZxW644c0v3MP7VWVRrZFz56dBycf6jpnJP02?t=https%3a%2f%2fforums.adobe.com%2fp
eople%2fjohn%2bbeardsworth&si=5592152726306816&pi=54e8046f-9999-4679-9e21-41
b8443644fc> in Photoshop Lightroom - View the full discussion
<http://t.signalequattro.com/e1t/c/5/f18dQhb0S7lC8dDMPbW2n0x6l2B9nMJW7t5XZs6
4JdZxW644c0v3MP7VWVRrZFz56dBycf6jpnJP02?t=https%3a%2f%2fforums.adobe.com%2fm
essage%2f7214977%237214977&si=5592152726306816&pi=54e8046f-9999-4679-9e21-41
b8443644fc> -
How can I map SSH from an outside network range to an internal host (ASA 5505)
Cisco Adaptive Security Appliance Software Version 7.2(4)
Device Manager Version 5.2(4)
- External network range that needs SSH access: 8.8.8.0/24
- Outside interface: 10.1.10.2 (NAT'd from 7.7.7.7)
- Inside Network: 192.168.100.0/24
- Inside host to redirect external SSH to: 192.168.100.98
Hi All,
I have a Cisco ASA 5505 (version above) and I have someone that needs to SSH into a box behind the ASA. I'm having a few issues trying to configure this access-list and NAT. I've tried many combinations and clearly my IOS is not as good as I thought.
Can anyone help with this? What commands should I enter to accomplish mapping SSH from an outside network range to an internal host?
Many thanks,
TarranThis may or may not work depending on how your modem handles the natting. On your firewall try this -
static (inside,outside) tcp interface 22 192.168.100.98 22
then add this to your acl on the outside interface of your ASA -
access-list outside_in permit tcp 8.8.8.0 255.255.255.0 host 10.1.10.2 eq 22
if you don't have an acl applied then add this extra step -
access-group outside_in in interface outside
Jon -
How can I translate this from PL/SQL into embedded SQL!?
CURSOR TEMP1 is
SELECT emp.fname fname, emp.lname lname, emp.ssn, dname,emp.salary salary, emp1.fname supervisor_fname, emp1.minit supervisor_mdlname,emp1.lname supervisor_lname FROM employee emp, employee emp1,department d
WHERE emp.superssn=emp1.ssn(+) and emp.dno=dnumber order by ssn;
PNTR_TEMP1 TEMP1%ROWTYPE;
--calcualting values for the cursor TEMP1
for PNTR_TEMP1 in TEMP1 loop
fname:= PNTR_TEMP1.fname;
lname:= PNTR_TEMP1.lname;
ssn := PNTR_TEMP1.ssn;
dname:=PNTR_TEMP1.dname;
sup_name:=PNTR_TEMP1.supervisor_fname||' '|| PNTR_TEMP1.supervisor_mdlname||' '||PNTR_TEMP1.supervisor_lname;
salary := PNTR_TEMP1.salary;
n_deps:=0 ;
/* how can I translate this to embedded SQL...I'm using C++*/Hi,
you can follow this link to use cursor in Pro*c /C++
http://www.csee.umbc.edu/help/oracle8/server.815/a68022/sql.htm
Regards -
SQL Queries in Code V/s Stored Procedures
Hi Friend,
Can any one of you guide me with following..
What is faster ? using SQL Queries in Java code or using Stored Procedures which are called from code?
I understnd Stroed Procedures are faster and definitely it provides more maintainability.
If any one can give me any links or resources which outlines pros and cons of using Stored Proc and SQL Queries embedded in Java than it would be a great help..
If there are any articles which proves either of the above is a preferred way, that would also help..
Appreciate the effort in advance !!
Thanks
GurudattWell one benefit of Stored Procs is that you "compile" it on the database whereas you might build your query on the fly in java... test coverage is important in order not to have such things as a typo in a column name....
Still, if you change a table, you have to go through all the procedures in SQL and likely to do so in some of your business object... and trust me, that can be hell!
It all depends on the use of the app...
From my experience, Stored procedure are much faster than built-on-the-fly SQL (and quite faster than prepared statements depending on the JDBC driver, the re-use of connections etc...)....
IMHO, you'd probably be wise to start of with prepared statements, and when the schema seems stable enough (ie unlikely to change), look for the slower queries and convert them to stroed procedures.
If you don't have to support several databases and are tight on performance, you can even include some logic in your stored procedure (e.g. update several tables, based on various selects...etc...). The language is usually quite powerful, and that can save you the run-time of selecting, converting to object , process and update (i.e. several roud-trip between DB and app)...
Tshcuss!
Chris -
Please,I Can't deploy Union Comand in SQL Stament With XMLGEN
I Have a Problem in SQL Stament
I Traying execute this SQL Stament With XMLGEN
Select
Number as "@Number",
NumRow as "@NumRow"
from
NewTable1
Union
Number as "@Number",
NumRow as "@NumRow"
from
NewTable2
Result: Show only NewTabla1 Rows.
How I Can Solution This ProblemUnless you're using the max-rows property which might be restricting the total number of rows, there's no way that XSU itself could affect the query outcome.
If you reverse the order of the queries
in the UNION, do you only get the rows from TABLE2 instead? Or regardless of order, you only get them from TABLE1? -
Urgent: Calling web service from PL/SQl fails with XML parsing
Hi,
I am trying to call a web service from PL/SQL (using SOAP protocol and UTL_HTTP built in Package).I am using Oracle 9i .I am calling from pl/sql block invoking web service method created in java.
I am getting the below response object as a SOAP protocol, but i couldn't able to parse the SOAP.
Could you please provide the values of FirstName, LastName and ErrorDescription
declare
request_env varchar2(32767);
v_xml XMLTYPE;
l_user_first_name varchar2(100);
l_user_last_name varchar2(100);
l_error_value varchar2(100);
begin
response_env:='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<UserInfoObjResponse xmlns:axis2ns1="http://www.test.com/services">
<axis2ns1:FirstName >First Name Output</axis2ns1:FirstName>
<axis2ns1:LastName>Last Name Output</axis2ns1:LastName>
<axis2ns1:ErrorDescription />
</UserInfoObjResponse>
</soapenv:Body>
</soapenv:Envelope>';
dbms_output.put_line('Length of Request:' || length(response_env));
dbms_output.put_line ('Request: ' || response_env);
v_xml := XMLTYPE(response_env);
-- SELECT EXTRACTVALUE(v_xml, '//UserInfoObjResponse/FirstName') INTO l_user_fast_name varchar2(100); FROM DUAL;
dbms_output.put_line ('l_user_first_name: ' || l_user_first_name);
dbms_output.put_line ('l_user_last_name : ' || l_user_last_name);
dbms_output.put_line ('l_error_value: ' || l_error_value);
end;In Oracle 9i:
SQL> declare
2 response_env varchar2(32767);
3 v_xml XMLTYPE;
4 l_user_first_name varchar2(100);
5 l_user_last_name varchar2(100);
6 l_error_value varchar2(100);
7 begin
8 response_env:='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
9 <soapenv:Body>
10 <UserInfoObjResponse xmlns:axis2ns1="http://www.test.com/services">
11 <axis2ns1:FirstName >First Name Output</axis2ns1:FirstName>
12 <axis2ns1:LastName>Last Name Output</axis2ns1:LastName>
13 <axis2ns1:ErrorDescription />
14 </UserInfoObjResponse>
15 </soapenv:Body>
16 </soapenv:Envelope>';
17
18 dbms_output.put_line('Length of Request:' || length(response_env));
19 -- dbms_output.put_line ('Request: ' || response_env);
20
21 v_xml := XMLTYPE(response_env);
22
23 select EXTRACTVALUE(v_xml,'/*:Envelope/*:Body/*:UserInfoObjResponse/*:FirstName/text()') first_name,
24 EXTRACTVALUE(v_xml,'/*:Envelope/*:Body/*:UserInfoObjResponse/*:LastName/text()') last_name,
25 EXTRACTVALUE(v_xml,'/*:Envelope/*:Body/*:UserInfoObjResponse/*:ErrorDescription/text()') error_description
26 into l_user_first_name, l_user_last_name, l_error_value
27 from dual;
28
29 dbms_output.put_line ('l_user_first_name: ' || l_user_first_name);
30 dbms_output.put_line ('l_user_last_name : ' || l_user_last_name);
31 dbms_output.put_line ('l_error_value: ' || l_error_value);
32 end;
33 /
Length of Request:530
l_user_first_name: First Name Output
l_user_last_name : Last Name Output
l_error_value:
PL/SQL procedure successfully completed.In Oracle 10g:
SQL> declare
2 response_env varchar2(32767);
3 v_xml XMLTYPE;
4 l_user_first_name varchar2(100);
5 l_user_last_name varchar2(100);
6 l_error_value varchar2(100);
7 begin
8 response_env:='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
9 <soapenv:Body>
10 <UserInfoObjResponse xmlns:axis2ns1="http://www.test.com/services">
11 <axis2ns1:FirstName >First Name Output</axis2ns1:FirstName>
12 <axis2ns1:LastName>Last Name Output</axis2ns1:LastName>
13 <axis2ns1:ErrorDescription />
14 </UserInfoObjResponse>
15 </soapenv:Body>
16 </soapenv:Envelope>';
17
18 dbms_output.put_line('Length of Request:' || length(response_env));
19 -- dbms_output.put_line ('Request: ' || response_env);
20
21 v_xml := XMLTYPE(response_env);
22
23 select r.*
24 into l_user_first_name, l_user_last_name, l_error_value
25 from XMLTABLE('/' PASSING v_xml
26 COLUMNS
27 first_name varchar2(30) PATH '/*:Envelope/*:Body/*:UserInfoObjResponse/*:FirstName/text()',
28 last_name varchar2(30) PATH '/*:Envelope/*:Body/*:UserInfoObjResponse/*:LastName/text()',
29 error_description varchar2(30) PATH '/*:Envelope/*:Body/*:UserInfoObjResponse/*:ErrorDescrition/text()'
30 ) r;
31
32 dbms_output.put_line ('l_user_first_name: ' || l_user_first_name);
33 dbms_output.put_line ('l_user_last_name : ' || l_user_last_name);
34 dbms_output.put_line ('l_error_value: ' || l_error_value);
35 end;
36 /
Length of Request:530
l_user_first_name: First Name Output
l_user_last_name : Last Name Output
l_error_value:
PL/SQL procedure successfully completed.Max
http://oracleitalia.wordpress.com
Edited by: Massimo Ruocchio on Feb 14, 2010 11:55 PM
Added the first one. -
Why i can't import videos from my Sony cam with iMovie on ipad 2?
Why i can't import videos from my Sony cam (HDR-XR500) with iMovie on ipad 2?
With my iMac i can import videos in iMovie but with iMovie iPad 2 we can't do this...very bad..it's a minimum to can import video from cam!!
Bye.Same with my Canon A 620 Ppwershot! :-((((
I want to create short diving movies on holidays with iMovie-editing and sent them to friends.
It does not work.
But that was one of the main reasons buying iPad and iMovie :-((((( -
HT203216 Can you remove contacts from an ipod updated with iTunes 11 software?
Does anyone know how you can remove all contacts from an iPod under the new iTunes 11 software? We sync to one family account and the kids don't want my contacts - how can you delete them? We can't find the area to select to eliminate the sync of the contacts when the iPod is synced to our account. Anyone able to help?
Ctrl + B for show Top Menu
View > Show Sidebar
itunes will now look more like itunes 10.
You can click on your device in the lefthand window as before
You may prefer to use the Music Sync page to select or deselect Playlists, Artists, Albums etc and click apply.
Delete your files is enabled by ticking the Manualy manage music option on the Device Summary page. You may have to scroll down to find it -
I can't download photos from my Card. Error Code 0x80010108.What can I do?
I can't download pictures from my sim card. Error Code 0x80010108. What can I do?
Try to import from your camera with Image Capture instead of iPhoto. Does that work?
Do you see your camera as a disk on the Desktop?
Can you open the image files from te Finder?
That wizzard-icon is puzzling. Have you used your camera with a PC and perhaps reformatted the SD Card from a different operating system? Then I'd try to import a different SD Card, that has been reformatted in the camera. -
Can't install packages from local repository created with repo-add
I did the following
repo-add /mnt/packages/repo.db.tar.gz /var/cache/pacman/pkg/*
cp /var/cache/pacman/pkg/* /mnt/packages
on one computer
connected the hard drive to another computer and did the following:
added the pacman.conf configurations as follows
[repo]
SigLevel = PackageRequired
Server = file:///mnt/packages
then ran
pacman -Sy
which worked.
and then I tried to install a package using pacman -S.but all the packages give me :
error: packagename: missing required signature,File:///var/cache/pacman/pkg/packagename is corrupted(invalid or corrupted package(PGP Signature))
then i tried:
pacman-key --init
pacman-key --populate archlinux
pacman -Syy
which didn't work and made no difference.what can I do?anatolik wrote:
One thing that comes to my mind is that repo directories have *.sig files next to the packages, see file structure here http://mirrors.kernel.org/archlinux/testing/os/x86_64/
But cache directory /var/cache/pacman/pkg/ does not have these sign files and it is why pacman complains. Where to find the sign files locally? I do not know the recommended way, but I see that /var/lib/pacman/sync/$REPO.db contains signature information, so you can write a script that extracts it.
Or you can use `repo-add --sign` and sign packages with your key, but it is not very secure.
PS Instead of using repo-add you might want just use repo files from /var/lib/pacman/sync/
I will try the above and report.
but it shouldn't be necessary according to https://wiki.archlinux.org/index.php/Pacman_tips
Maybe you are looking for
-
Reading a file from ftp server
Hi I am able to put file on ftp server using ftp adapter.But same settings are not working while polling file on ftp. Do i need to do some settings for get operation??
-
ITunes 8.1 works great but killed wireless internet connection
I installed version 8.1 on both my laptop( PowerBook g4/ OS 10.4.11) and desktop (imac intel / OS 10.5) and after restarting the computer, the wireless internet connection stopped working on both. I would open Safari and it would be a blank page and
-
Customer Standard page is behaving differently in two different instances Y
HI Guru's, I am querying the data in one Customer standard page in support6 instance for eg: 27868 is a Acccount Number we are searching for this and we are getting the Data in this instance here the thing is the Account is Inactive and we can view e
-
Cannot Connect to App Store/Trouble Connecting iPod to PC
Im using a iPod 5th generation, been a while now when ever i clicks on App Store it never connects Im also having trouble with Charging my iPod. When ever I connects it to my computer to sync it or to charge my iPod it pops up saying USB Device Not
-
What is the best way to switch off Daylight Saving Time?
What is the best way to switch off Daylight Saving Time for a DST enabled timezone?