How to use Unique key constraint in EJB
Hi All,
I am using an entity bean to create my table in MySQL4.1.13
I have a table called user which has userid,username,password as its columns.
The userid is a primary key over here.
But I want the user name to be unique.
I.e if a user with the name 'Adrian' is present in the database then another user with this user name should not be created.
I have been told that you can configure a unique key in jbosscmp-jdbc.xml using insert-after-ejb-post-create.
But i dont know how to use it.
Can anyone give me a sample code for using this.
Any help would be appreciated.
Thanks
P2
Please explain your problem better. Really can't figure what you are trying to do.....
choosing which sql statement to use at runtime
or creating dynamic sql statement at runtime
which??
Regards
Similar Messages
-
Dear community,
I have a flat data set which I run through a lookup and return. I want to check if at least one of the records matching a unique key constraint had a successful return without merging all the records. Can some one point me in the right direction?
Thanks!
MarcHi,
Sounds like a job for the Lookup Check processor!
As with all check processors, it adds a flag attribute (with a Y/N value) that denotes if the lookup was successful or not, as well as filtering records based on this at output.
Lookup Check does the same as Lookup and Return but does not return the record(s) looked up.
Also note that Lookup and Return does not actually merge records, but it does pull back the return data (which you can then split if you want a record for each).
Regards,
Mike -
*** [23000][2627][Microsoft][SQL Server Native Client 11.0][SQL Server]Violation of UNIQUE KEY constraint 'ClientPushMachine_G_AK'. Cannot insert duplicate key in object 'dbo.ClientPushMachine_G'. The duplicate key value is (16777412). : sp_CP_CheckNewAssignedMachine
CCCRT::RunSQLStoredProc - Failed to execute SQL cmd exec [sp_CP_CheckNewAssignedMachine] N'xxx', 1
CCRQueueRequest::GetRequestFromQueue - Failed to execute SQL cmd sp_CP_CheckNewAssignedMachine
I get the above issue and the one below at a client site; the error started with the error below then changed to the one reported above and back to the one below. Everything is working as it should but the issues
started when one of the admins at the data-centre incorrectly applied a gpo which affected a number of service accounts (sccm inclusive) and they expired....hence reporting in sccm got broke as well as this error in the ccm.log file appeared.
Remote client install still works but I believe this error affects new client discovered by sccm, so in other words devices discovered by sccm do not get the client installed automatically....but if all access and permissions are in place...pushing out the
client to the new discovered system works, it just not done automatically, which kinda defeats one the reasons for using sccm.
I have searched the breadth of the tinternet and I can only find two technet reference to the same error - one says to edit the stored procedure on the sql server which I don't think should be done... Like Jason said and I concur....its bad joo joos.
The second suggestion, said you should select all the options in the Client Push Installation properties, I have tried this but hasn't solved the problem.
I am planning to upgrade the site to the R2 CU3 before the end of the year but I would like to resolve this error before the upgrade.
The site is currently sccm 2012 sp1
Any idea?> Resolution? sil vous plait!
MerciHi ,
Please back up the database of the SCCM site. Then run the following query against the Site DB and see how it goes.
DELETE FROM System_SMS_Resident_ARR
WHERE ItemKey IN (
SELECT ItemKey FROM vSystem_SMS_Resident_ARR
GROUP BY ItemKey
HAVING COUNT(ItemKey) > 1
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. -
How we use Surrogate Keys for snowflake dimension
Hi All,
my question is - How we use Surrogate Keys for snowflake dimension
i heard from some body Surrogate Keys only work with star schema.
please correct me if i wrong.
Regards,
ManishHi manishcal16PPS,
According to your description, you can only create natural key in your dimension. But it's not working when using surrogate key. Right?
In Analysis Services, the snowflake schema of the dimensions are represented by more than one dimension table in other words its takes multiple dimension tables to define a dimension. Surrogate key are just some extra, redundant, unique key based on the
natural key. So there's no direct relationship or some limitations between surrogate keys and snowflake schema.
In this scenario, since there's relationship between the two dimensions, you should create natural key. For using natural key or surrogate key. Please refer to an article below:
Surrogate Key vs. Natural Key
For understanding star/snowflake schema, please see:
Understanding Star and Snowflake Schemas
Regards,
Simon Hou
TechNet Community Support -
Hello,
I've trouble enrolling AMT computer with SCCM 2012
I've foud the following error in Amtproxymgr.log
15/05/2014 14:54:50
Found instruction file: D:\Apps\Microsoft Configuration Manager\inboxes\amtproxymgr.box\{C6B0AAB5-BB02-4673-B44A-118917419389}.OTP
15/05/2014 14:54:50
It's client provisioning request to be processed.
15/05/2014 14:54:50
Stored provisioning request into database. SMSID: Machine_GUID
15/05/2014 14:54:50
Target machine SMSID:Machine_GUID is a AMT capable machine.
15/05/2014 14:54:50
Passed SanityCheckBeforeProvision(). FQDN is MYCOMPUTERNAME.domain.
15/05/2014 14:54:50
BASE64 string OTP is : OTP_STRING
15/05/2014 14:54:58 *** EN_EnrollmentAdminInsert @ProfileId = '16777217', @AssignedSiteCode = N'SITE_CODE', @DeviceName = N'MYCOMPUTERNAME', @ResourceID = '16816953', @OwnerIdentity = N'', @ClientType
= '1', @OrganizationUnit = N'LDAP://OU=OU_NAME
15/05/2014 14:54:58
*** [23000][2627][Microsoft][SQL Server Native Client 11.0][SQL Server]Violation of UNIQUE KEY constraint 'EN_EnrollmentRecords_AK'. Cannot insert duplicate key in object 'dbo.EN_EnrollmentRecords'. The duplicate key value is (MYCOMPUTERNAME). : EN_EnrollmentAdminInsert
15/05/2014 14:54:58
Fail to insert Enrollment Record!
15/05/2014 14:54:58
Error: Failed to create enrollment record.
If I do a query on V_R_SYSTEM the resource ID for MYCOMPUTERNAME is 16816953.
If I do a query on EN_EnrollmentRecords the Ressource Id associated to
MYCOMPUTERNAME is 16777351
So there is already a record for MYCOMPUTERNAME in
EN_EnrollmentRecords.
I think the reason is that the computer resource has been removed from SCCM and then readded. The computer has now a new Ressource ID. But the deletion of the previous computer ID did not removed the record from
EN_EnrollmentRecords.
How can I solve this ?Open Sql Server Management Studio, and do the query below.
select * from dbo.en_EnrollmentRecords where ResourceID ='16777351'
delete from dbo.EN_EnrollmentRecords where ResourceID = '16777351'
Delete the Device from console and AD and try provisioning again.
Note: Please backup your Database before doing this modification. Modifying database will be at your own risk.
Juke Chou
TechNet Community Support -
How to use a key file in the FTP Task using and SSL connection
In the past I have used this code to set the FTP pass word in an FTP component task in SSIS.
Does anyone know how to use a Key file in an SSL connection to download a file from an FTP site? If not can you tell me where I can get the C# code examples to learn how to create a script task or if there is another way in SSIS to download large files
from an SSL FTP site? Thank you for any help offered.
public void Main()
ConnectionManager FTPConn;
FTPConn = Dts.Connections["FTPServer"];
FTPConn.Properties["ServerPassword"].SetValue(FTPConn, Dts.Variables["FTPPassword"].Value);
Dts.TaskResult = (int)ScriptResults.Success;
AntonioYou can use SFTP for this.
This is a way of implementing SFTP in SSIS using standard tasks
http://visakhm.blogspot.in/2012/12/implementing-dynamic-secure-ftp-process.html
also see
http://blog.goanywheremft.com/2011/10/20/sftp-ftps-secure-ftp-transfers/
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Violation of unique key constraint 'IX_User_LoginName' error
I get the following error while doing a sync:
violation of unique key constraint 'IX_User_LoginName'
I have already updated the web user ids on all my users, as well as those on my BPs. After I do the sync all my data is being deleted.I get the following error while doing a sync:
violation of unique key constraint 'IX_User_LoginName'
I have already updated the web user ids on all my users, as well as those on my BPs. After I do the sync all my data is being deleted. -
i have deploy an EJB in weblogic 6.1,but how to use jsp to invoke the EJB's method?
thanks!You'd do something like:
<%
//vvv this part can potentially be done in initialization
Context ctx = getInitialContext();
BeanHome home =
(BeanHome)PortableRemoteObject.narrow(ctx.lookup("the.jndi.name"),
BeanHome.class);
Bean b = home.create();
//^^^
Result r = b.invokeMethod();
%>
"toxin" <[email protected]> wrote in message
news:3d2e95e5$[email protected]..
>
i have deploy an EJB in weblogic 6.1,but how to use jsp to invoke theEJB's method?
thanks! -
How to Use "Hot Key" in the Search help
Hi,
Please explain how to use hot key with some example.TYPE-POOLS SLIS. DATA: BEGIN OF itab OCCURS 0,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
END OF itab.
PARAMETERS: P_BUKRS TYPE BUKRS.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BUKRS.
PERFORM F4_FOR_BUKRS.
FORM F4_FOR_BUKRS. DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
ES_SELFIELD TYPE SLIS_SELFIELD. * Get data
SELECT BUKRS
BUTXT
FROM T001
INTO TABLE itab
up to 10 rows .
Get field
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'ITAB'
CHANGING
CT_FIELDCAT = IT_FIELDCAT[]. LOOP AT IT_FIELDCAT.
IT_FIELDCAT-KEY = SPACE.
IF IT_FIELDCAT-FIELDNAME = 'BUTXT'.
IT_FIELDCAT-EMPHASIZE = 'C710'.
IT_FIELDCAT-HOTSPOT = X.
ENDIF.
IF IT_FIELDCAT-FIELDNAME = 'BUKRS'.
IT_FIELDCAT-EMPHASIZE = 'C610'.
ENDIF. MODIFY IT_FIELDCAT.
ENDLOOP. CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE = 'THIS IS FOR F4 IN COLOR'
I_TABNAME = 'ITAB'
IT_FIELDCAT = IT_FIELDCAT[]
IMPORTING
ES_SELFIELD = ES_SELFIELD
TABLES
T_OUTTAB = ITAB . ENDFORM. " F4_FOR_BUKRS -
Documentation How to use Virtual Key fig.
Hi all ,
Can u please send me Documentation How to use Virtual Key fig. to [email protected]
Nice weekend.check this doc to get a headsup on Virtual objects - though the doc talks abt the virtual char, the procedure is pretty much similar to KF too.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/how%20to%20use%20variable%20time%20references%20in%20currency%20conversion
How to implement Virtual Characteristics or Virtual key figures -
How to manage unique key ?
My table has a unique key ... but OWM prevents version enabling
of a table which has a unique key.
Before version enabling the unique key means: a same value
cannot be used twice.
After version enabling it should mean: a same value cannot be
used twice at the same time .
How to manage such a situation ?
Thank you.Workspace Manager currently does not support versioning of tables
that contain unique constraints. There is some confusion in
defining what is unique in a multi-version system. Is it unique
in a branch of versions or does it have to be unique in the
entire system?
We plan to address this in the next release. In the meantime, we
welcome your suggestions. Also, I am interested in knowing the
application context in which you are using Workspace Manager.
thanks
Arun -
How about use partial key to loop at a hashed table?
Such as I want to loop a Internal table of BSID according to BKPF.
data itab_bsid type hashed table of BSID with unique key bukrs belnr gjahr buzid.
Loop at itab_bsid where bukrs = wa_bkpf-bukrs
and belnr = wa_bkpf-belnr
and gjahr = wa_bkpf-gjahr.
endloop.
I know if you use all key to access this hashed table ,it is certainly quick, and my question is when i use partial key of this internal hashed table to loop it, how about its performance.
Another question is in this case(BSID have many many record) , Sorted table and Hashed table , Which is better in performance.You can't cast b/w data reference which l_tax is and object reference which l_o_tax_code is.
osref is a generic object type and you store a reference to some object in it, right? So the question is: what kind of object you store there? Please note - this must be an object reference , not data reference .
i.e
"here goes some class
class zcl_spfli definition.
endclass.
class zcl_spfli implementation.
endclass.
"here is an OBJECT REFERENCE for it, (so I refer to a class) i.e persistent object to table SPFLI
data oref_spfli type ref to zcl_spfli.
"but here I have a DATA REFERENCE (so I refer to some data object) i.e DDIC structure SPFLI
data dref_spfli type ref to spfli.
So my OSREF can hold only oref_spfli but it not intended for dref_spfli . That's why you get this syntax error. Once you have stored reference to zcl_spfli in osref then you will be able to dereference it and access this object's attributes.
data: osref type osref.
create object osref_spfli.
osref = osref_spfli.
"now osref holds reference to object, you can deference it
oref_spfli ?= osref.
osref_spfli->some_attribute = ....
OSREFTAB is just a table whose line is of type OSREF (so can hold multiple object references - one in each line).
Regards
Marcin -
Using FOreign key constraints on tables in database.
I am student and novice in the field of ORACLE and PL/SQL and Database Creation. I had created a database consisting tables and got problem while applying foreign key constraints.
CUST_MSTR
CREATE TABLE "DBA_BANKSYS"."CUST_MSTR"("CUST_NO" VARCHAR2(10),
"FNAME" VARCHAR2(25), "MNAME" VARCHAR2(25), "LNAME" VARCHAR2(25),
"DOB_INC" DATE NOT NULL, "OCCUP" VARCHAR2(25), "PHOTOGRAPH" VARCHAR2(25),
"SIGNATURE" VARCHAR2(25), "PANCOPY" VARCHAR2(1), "FORM60" VARCHAR2(1));
(CUST_NO is PRIMARY KEY, )
-- EMP_MSTR
CREATE TABLE "DBA_BANKSYS"."EMP_MSTR"("EMP_NO" VARCHAR2(10),
"BRANCH_NO" VARCHAR2(10), "FNAME" VARCHAR2(25), "MNAME" VARCHAR2(25),
"LNAME" VARCHAR2(25), "DEPT" VARCHAR2(30), "DESIG" VARCHAR2(30));
(EMP_NO is primary key )
--NOMINEE_MSTR
CREATE TABLE "DBA_BANKSYS"."NOMINEE_MSTR"("NOMINEE_NO" VARCHAR2(10),
"ACCT_FD_NO" VARCHAR2(10), "NAME" VARCHAR2(75), "DOB" DATE,
RELATIONSHIP" VARCHAR2(25));
(NOMINEE_NO is primary key )
--ADDR_DTLS
CREATE TABLE "DBA_BANKSYS"."ADDR_DTLS"("ADDR_NO" NUMBER(6),
"CODE_NO" VARCHAR2(10), "ADDR_TYPE" VARCHAR2(1), "ADDR1" VARCHAR2(50),
"ADDR2" VARCHAR2(50), "CITY" VARCHAR2(25), "STATE" VARCHAR2(25),
"PINCODE" VARCHAR2(6));
( ADDR_NO is primary key )
Problem: I want to apply foreign key constraints on ADDR_DTLS table so that Before inserting value in ADDR_DTLS table it must check, VALUE in ADDR_DTLS.CODE_NO must be PRESENT either in attribute value CUST_MSTR.CODE_NO or EMP_MSTR.CODE_NO or NOMINEE_MSTR.CODE_NO table .
I applied the foreign key constraints using this syntax
CREATE TABLE "DBA_BANKSYS"."ADDR_DTLS"("ADDR_NO" NUMBER(6),
"CODE_NO" VARCHAR2(10), "ADDR_TYPE" VARCHAR2(1), "ADDR1" VARCHAR2(50),
"ADDR2" VARCHAR2(50), "CITY" VARCHAR2(25), "STATE" VARCHAR2(25),
"PINCODE" VARCHAR2(6),
constraints fk_add foreign key CODE_NO references CUST_MSTR. CODE_NO,
constraints fk_add1 foreign key CODE_NO references EMP_MSTR. CODE_NO,
constraints fk_add2 foreign key CODE_NO references NOMINEE_MSTR.CODE_NO);
(foreign key)
ADDR_DTLS.CODE_NO ->CUST_MSTR.CUST_NO
ADDR_DTLS.CODE_NO ->NOMINEE_MSTR.NOMINEE_NO
ADDR_DTLS.CODE_NO ->BRANCH_MSTR.BRANCH_NO
ADDR_DTLS.CODE_NO ->EMP_MSTR.EMP_NO
When I applied foreign key constraints this way, its gives a error called foreign key constraints violation. (I understand that, its searches the attribute value of ADDR_DTLS.CODE_NO in all the three tables must be present then the value will be inserted. But I want, if the value is in any of the three table then its should insert the value or its gives an error.)
Please help me out, though i put the question and i want too know how to apply the forign key in this way. and is there any other option if foreign key implementation is not pssible.If you are on 11g you can use ON DELETE SET NULL:
CREATE TABLE addr_dtls
( addr_no NUMBER(6) CONSTRAINT addr_pk PRIMARY KEY
, addr_cust_no CONSTRAINT addr_cust_fk REFERENCES cust_mstr ON DELETE SET NULL
, addr_emp_no CONSTRAINT addr_emp_fk REFERENCES emp_mstr ON DELETE SET NULL
, addr_nominee_no CONSTRAINT addr_nominee_fk REFERENCES nominee_mstr ON DELETE SET NULL
, addr_type VARCHAR2(1)
, addr1 VARCHAR2(50)
, addr2 VARCHAR2(50)
, city VARCHAR2(25)
, state VARCHAR2(25)
, pincode VARCHAR2(6) );In earlier versions you'll need to code some application logic to do something similar when a parent row is deleted, as otherwise the only options are to delete the dependent rows or raise an error.
btw table names can be up to 30 characters and don't need to end with MSTR or DTLS, so for example CUSTOMERS and ADDRESSES might be more readable than CUST_MSTR and ADDR_DTLS. Also if the Customer/Employee/Nominee PKs are generated from a sequence they should be numeric.
Edited by: William Robertson on Aug 15, 2010 6:47 PM -
How to use Remote key for linking two repository
Hi,
I have a challenge like not to repeate common tables like Company_code,Currency,Vendor name,customer name across all repositories.
Is there any way I can use 'Remote key' to link different repository.
I can create a Main table with all common attributes required across the repository but want to know how I can connect it to different repository.
For example to get company-code in Vendor table , how can I link Company-code main table(customized) in another repository may be thru 'Remote key'.
Going thru java api route is not prefffered for the sake of simple solution.
Appreciate your help in providing any idea and detail steps for the process.
-regards, Reocould you confirm the name and the existence of this file "IOMM_20121213_060736.csv" ?
same error like:
http://www.oracle-base.com/articles/9i/external-tables-9i.php
if the load files have not been saved in the appropriate directory the following result will be displayed.
SQL> SELECT *
2 FROM countries_ext
3 ORDER BY country_name;
SELECT *
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file Countries1.txt in EXT_TABLES not found
ORA-06512: at "SYS.ORACLE_LOADER", line 14
ORA-06512: at line 1Edited by: Fran on 10-ene-2013 23:32 -
How to use shortcut keys on wireless keyboard with ipad
i just purchased an ipad 4 with a wireless keyboard and do not know how to use the function keys on the wireless keyboard to access the homescreen, scroll up and down, etc. please help with anything i need to turn on/off or download . thanks
If you have more than one keyboard active, you may be using a different one than you want. Use the "globe" key to make sure your virtual keyboard is set to Japanese Romaji or Japanese Kana. Which one do you use?
On the hardware keyboard, use apple/command plus space to switch between different keyboard layouts which may be active.
Maybe you are looking for
-
How do I access pictures from my iPhone saved in iCloud in a computer so that I can see & delete some of them from iCloud to free up the free 5GB?.
-
How do I get the lyrics on iTunes to show up on my iPhone 4 iOS 6?
I put lyrics in the lyrics section of the songs on iTunes but when I sync it to my iPhone they won't show up. Is there something I have to do to make them show up or are lyrics disabled on iOS 6. I they can be put on my iPhone then could you tell me
-
what is the trick to opening all the files i receive in mail such as wmv, j.wm, pps, asf? I get error message that says i don't have the right application to open these files. is there software out there to download? thanks, den man
-
Flash Player 12 specific issue.
Hi, I have found below issue on Flash Player 12, "A script in this movie is causing Adobe Flash Player to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script? Yes / No." However this issue not a
-
Is Adobe Air needed for Photoshop elements 12?
I need some space for my computer and was just wondering if I needed adobe air in order to run Photoshop smoothly.An answer would really help.