A composite primary key with two KeyField: a rope and a sequential int.
Hi allAccording to [url http://download.oracle.com/docs/cd/E17277_02/html/java/com/sleepycat/persist/model/PrimaryKey.html#sequence ()] sequence JavaDoc: a composite key class can also be used to substitute the sort order, but it can contain only a single key field which has one of the types mentioned previously.
We strive to create a composite PK as follows:
@Persistent
public class ExamplePK {
@KeyField(1) Integer seq;
@KeyField(2) String admon;
public String getAdmon() {
return admon;
}
public void setAdmon(final String admon) {
this.admon = admon;
}
public Integer getSeq() {
return seq;
}
public void setSeq(final Integer seq) {
this.seq = seq;
}
}
@Entity
public class ExamplePojo {
// Relational fields
@PrimaryKey(sequence="ExampleSeq")
private ExamplePK idExample;
public ExamplePK getIdExample() {
return idExample;
}
public void setIdExample(final ExamplePK idExample) {
this.idExample = idExample;
}
}
but we get the following exception:java.lang.IllegalArgumentException:A composite key class used with a sequence may contain only a single integer key field: es.correos.ape.dao.notification.pojo.ExamplePK[Server1:1291138230743]
at com.sleepycat.persist.impl.CompositeKeyFormat.getSequenceKeyFormat(CompositeKeyFormat.java:292)
at com.sleepycat.persist.impl.PersistKeyAssigner.<init>(PersistKeyAssigner.java:39)
at com.sleepycat.persist.impl.Store.getPrimaryIndex(Store.java:337)
at com.sleepycat.persist.EntityStore.getPrimaryIndex(EntityStore.java:307)
What we're doing wrong?ARO
/ Caesar.
Caesar, I think that the wording of the javadoc and exception message is incorrect or at least confused, and I answer key for a future version.
-mark
Tags: Database
Similar Questions
-
change a composite primary key
HelloI have a table that has a composite primary key with 3 columns (col1, col2, col3)
Now I need to change the primary key (col1, col2, col4) remove composite col3 replace with col4
col1 col2 COL3 COL4 col5 1 one x p DFD 1 one There p DFD 1 one z p SD 1 one m p amplifier 1 one n p Try There are thousands of records in the table in the format above. How to make this change?
Thank you.
In this case, you will need to establish that if the change to the primary key makes sense - if so, you'll have to remove some lines to remove duplicates. I think that if this requirement has been raised at a request of the company, they will (should) have indicated what lines need to be maintained.
If it is not sensible, you will need to go to the one who asked for the change and get them to change their mind or tell you what to do with duplicate lines.
Out of curiosity, why did you change the primary key?
-
Hello
I have a page with adf faces table, I need to pass values to the table to another the inputfields page (both fields are composite primary keys), I'm passing values but I get the error while I'm passing values twice on the next page with a button command (using setPropertyListener) this error... Please help me?
Houston-29114 ADFContext is not configured to process this exception messages. Use the code of exception stack trace and error to investigate the root cause of this exception. Root cause error code is Houston-25013. Error messages settings are {0 = oracle.jbo.Key [22 9]}
ADF_FACES-60097: for more information, see the error log of the server for an entry beginning with: ADF_FACES - Exception during the PPR, #1 60096:Server
The error log is...
URL - target http://127.0.0.1:7101/Recruting-ViewController-context-root/faces/login.JSPX
< ViewHandlerImpl > < _checkTimestamp > Apache Trinidad runs with control of activated timestamp. This should not be used in a production environment. See the org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION property in WEB-INF/web.xml
< UIXEditableValue > < _isBeanValidationAvailable > Validation Bean A provider is not present, so bean validation is disabled
passing the user name: 201157
< _LogUnhandledException > ADF_FACES - 60098:Faces life cycle receives exceptions that are unhandled in phase 5 of INVOKE_APPLICATION
oracle.jbo.TooManyObjectsException: Houston-25013: too many objects correspond to the oracle.jbo.Key [22 primary key 9].
at oracle.jbo.server.EntityCache.throwTooManyObjectsException(EntityCache.java:608)
at oracle.jbo.server.EntityCache.handleDuplicateKey(EntityCache.java:617)
at oracle.jbo.server.EntityCache.addForAltKey(EntityCache.java:1030)
at oracle.jbo.server.EntityCache.add(EntityCache.java:541)
at oracle.jbo.server.EntityImpl.callCreate(EntityImpl.java:1141)
at oracle.jbo.server.ViewRowStorage.create(ViewRowStorage.java:1140)
at oracle.jbo.server.ViewRowImpl.create(ViewRowImpl.java:461)
at oracle.jbo.server.ViewRowImpl.callCreate(ViewRowImpl.java:478)
at oracle.jbo.server.ViewObjectImpl.createInstance(ViewObjectImpl.java:5800)
at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:1941)
at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2504)
at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2545)
at oracle.jbo.server.ViewRowSetImpl.createAndInitRow(ViewRowSetImpl.java:2510)
at oracle.jbo.server.ViewObjectImpl.createAndInitRow(ViewObjectImpl.java:11133)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1342)
at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2169)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:731)
at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:402)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:210)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke (unknown Source)
at com.sun.el.MethodExpressionImpl.invoke (unknown Source)
at oracle.adf.controller.internal.util.ELInterfaceImpl.invokeMethod(ELInterfaceImpl.java:173)
at oracle.adfinternal.controller.activity.MethodCallActivityLogic.execute(MethodCallActivityLogic.java:163)
at oracle.adfinternal.controller.engine.ControlFlowEngine.executeActivity(ControlFlowEngine.java:1091)
at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:982)
at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:880)
at oracle.adfinternal.controller.engine.ControlFlowEngine.routeFromActivity(ControlFlowEngine.java:553)
at oracle.adfinternal.controller.engine.ControlFlowEngine.performControlFlow(ControlFlowEngine.java:158)
at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleAdfcNavigation(NavigationHandlerImpl.java:115)
at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:84)
at org.apache.myfaces.trinidadinternal.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:50)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:159)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1137)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:361)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
to weblogic.servlet.internal.StubSecurityHelper$ ServletServiceAction.run (StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to oracle.security.jps.ee.http.JpsAbsFilter$ 1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged (Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.wrapRun (WebAppServletContext.java:3715)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.run (WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
< RegistrationConfigurator > < handleError > ADF_FACES - 60096:Server Exception during the PPR, #1
oracle.jbo.TooManyObjectsException: Houston-29114 ADFContext is not configured to process this exception messages. Use the code of exception stack trace and error to investigate the root cause of this exception. Root cause error code is Houston-25013. Error messages settings are {0 = oracle.jbo.Key [22 9]}
at oracle.jbo.server.EntityCache.throwTooManyObjectsException(EntityCache.java:608)
at oracle.jbo.server.EntityCache.handleDuplicateKey(EntityCache.java:617)
at oracle.jbo.server.EntityCache.addForAltKey(EntityCache.java:1030)
at oracle.jbo.server.EntityCache.add(EntityCache.java:541)
at oracle.jbo.server.EntityImpl.callCreate(EntityImpl.java:1141)
at oracle.jbo.server.ViewRowStorage.create(ViewRowStorage.java:1140)
at oracle.jbo.server.ViewRowImpl.create(ViewRowImpl.java:461)
at oracle.jbo.server.ViewRowImpl.callCreate(ViewRowImpl.java:478)
at oracle.jbo.server.ViewObjectImpl.createInstance(ViewObjectImpl.java:5800)
at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:1941)
at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2504)
at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2545)
at oracle.jbo.server.ViewRowSetImpl.createAndInitRow(ViewRowSetImpl.java:2510)
at oracle.jbo.server.ViewObjectImpl.createAndInitRow(ViewObjectImpl.java:11133)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1342)
at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2169)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:731)
at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:402)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:210)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke (unknown Source)
at com.sun.el.MethodExpressionImpl.invoke (unknown Source)
at oracle.adf.controller.internal.util.ELInterfaceImpl.invokeMethod(ELInterfaceImpl.java:173)
at oracle.adfinternal.controller.activity.MethodCallActivityLogic.execute(MethodCallActivityLogic.java:163)
at oracle.adfinternal.controller.engine.ControlFlowEngine.executeActivity(ControlFlowEngine.java:1091)
at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:982)
at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:880)
at oracle.adfinternal.controller.engine.ControlFlowEngine.routeFromActivity(ControlFlowEngine.java:553)
at oracle.adfinternal.controller.engine.ControlFlowEngine.performControlFlow(ControlFlowEngine.java:158)
at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleAdfcNavigation(NavigationHandlerImpl.java:115)
at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:84)
at org.apache.myfaces.trinidadinternal.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:50)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:159)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1137)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:361)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
to weblogic.servlet.internal.StubSecurityHelper$ ServletServiceAction.run (StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to oracle.security.jps.ee.http.JpsAbsFilter$ 1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged (Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.wrapRun (WebAppServletContext.java:3715)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.run (WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Hi all, finally I found the solution to this exception.
I did the following steps to solve the problem.
1. create a bean and use this method
public void tooManyObjectsMatchExceptioHandeler() {}
Add the code in the event here...
System.out.println ("inside the Handeler");
FacesMessage message =
new FacesMessage ("Type your friendly message");
message.setSeverity (FacesMessage.SEVERITY_ERROR);
FacesContext fc = FacesContext.getCurrentInstance ();
fc.addMessage (null, message);
}
Now, drag and drop the file above java projects in data controls in the browser of the application.
2. drag a workflow method call (where u get exception as Houston-25013) and call this method as an activity of the exception handler,
Now, do a right click on this--> definition of the page method call create or go to definition of the page--> create a link Action method and select the above method in the select and file def page this method call in the workflow then go to properties inspector set out fixed property (here name of activities of method call) u give.
-
request for deletion with a composite primary key
I have the following problem, which seems very simple, but I'm a bit at a loss :)
I have a table T1 with composite primary key F1 and F2.
There is a second table I want to use to delete records of T1 T2. It contains als F1 and F2.
I want to do something like this
Of course, this does not work.delete from T1 where T1.F1, T1.F2 in (select T2.F1, T2.F2 from T2);
There are solutions, but I find them unsatisfactory:
-A loop of PL/SQL and passes the key one
-Concatenate F1 and F2: where T1. F1 | T1. F2 to (select T2. F1 | W2M T2 F2); - but it's very ugly.
Surely it must be possible in a simple SQL statement...
Thank you!
Robdelete from T1 where (F1,F2) in (select T2.F1, T2.F2 from T2);
Max
[My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/01/17/supporto-di-xml-schema-in-oracle-xmldb/] -
Hi all
I need mapping composite primary key to foreign key.
Example:
first create LOCATION_MASTER table with composite primary key,
CREATE TABLE LOCATION_MASTER (LOC_CITYCODE VARCHAR2 (10))
LOC_CITY VARCHAR2 (30),
CONSTRAINT ANN_LOCMAS_PK PRIMARY KEY (LOC_CITYCODE, LOC_CITY)
);
Then create the route_master table. In the table route_master source_city, destination_city maps to loc_city
CREATE TABLE ROUTE_MASTER (ROUTE_ID NUMBER (3),)
SOURCE_CITY VARCHAR2 (30),
DESTINATION_CITY VARCHAR2 (30),
CONSTRAINT ANN_INPK PRIMARY KEY (ROUTE_ID).
CONSTRAINT ANN_INFK FOREIGN KEY (SOURCE_CITY, DESTINATION_CITY)
REFERENCES LOCATION_MASTER (LOC_CITY)
);
If I create like that, then I got error...
The samething is my need. So please fix the code that I have attached.
Please do what is necessary...
Thank you
AnnCONSTRAINT ANN_LOCMAS_PK PRIMARY KEY (LOC_CITYCODE, LOC_CITY)
CONSTRAINT ANN_INFK FOREIGN KEY (SOURCE_CITY, DESTINATION_CITY)
REFERENCES LOCATION_MASTER (LOC_CITY)It is not possible to refer to the part of the parent key. In your case, you must create a separate unique constraint on LOCATION_MASTER. LOC_CITY and then to establish referential constraints of ROUTE_MASTER. SOURCE_CITY and ROUTE_MASTER. DESTINATION_CITY individually i.e. two different referential constraints.
-
Composite primary key (reverse)
Hello
I created a table with composite primary key
for example: -.
create table demo (NUMBER one, NUMBER two, the key pk_composite primary (one, two);)
Insert into demo values (1,2);
1 row inserted
Insert into demo values (1,2);
ORA-00001: unique constraint (username. PK_composite) violated
its ok...........................
I know composite primary will not work reverse (i.e.)
Select * from demo;
one | two
1. 2
Insert into demo values (2,1);
1 row inserted
Select * from demo;
one | two
1. 2
2. 1
I need to do reverse, is it possible to make? (i.e.)
Insert into demo values (2,1); -This should not
Please help me... Thanks in advance...A quick way to do this is to create a unique index based on a function like this:
create unique index demo_i1 on demo (least(one,two) ,greatest(one,two));
-
By specifying the Composite primary key (columns 4 and 5)
Hi all
I am new to Oracle Apex,
I have a few paintings with a composite primary key (4 or 5 columns)... When I try to create a primary key constraint, it gives me only 3 columns!
Any help please in how can I solve this problem?
Thanks in advance
You are probably using the workshop for this sql Object Explorer
which seems to be limited to 4 columns on APEX 4.2.3
best thing to do is to create manually using the sql commands in sql workshop, here's an example:
{code}
CREATE UNIQUE INDEX myui ON JC_ACCOUNT
(TITLE_ID, FAMILY_NAME GIVEN_NAME, GENDER_ID, TELEPHONE_NUMBER)
/
{code}
I hope this helps you
KR
Martin
-
assign a Composite primary key
Hi all
I have the table with composite primary key (ID, year)
I want to assign the value using triggers and sequence
the number will start from 1 and current year to the end of the year and start again next year
How can I do this
Best regardsHello
mkm802 wrote:
Dear FrankHow can please I use the ROW_NUMBER for this
You have not posted the CREATE TABLE and INSERT statements for examples of data, so I'll use scott.emp:
SELECT ename , deptno , EXTRACT (YEAR FROM hiredate) AS year , hiredate , ROW_NUMBER () OVER ( PARTITION BY deptno , EXTRACT (YEAR FROM hiredate) ORDER BY hiredate ) AS r_num FROM scott.emp ORDER BY deptno , hiredate ;
Output:
ENAME DEPTNO YEAR HIREDATE R_NUM ---------- ---------- ---------- ----------- ---------- CLARK 10 1981 09-Jun-1981 1 KING 10 1981 17-Nov-1981 2 MILLER 10 1982 23-Jan-1982 1 SMITH 20 1980 17-Dec-1980 1 JONES 20 1981 02-Apr-1981 1 FORD 20 1981 03-Dec-1981 2 SCOTT 20 1987 19-Apr-1987 1 ADAMS 20 1987 23-May-1987 2 ALLEN 30 1981 20-Feb-1981 1 WARD 30 1981 22-Feb-1981 2 BLAKE 30 1981 01-May-1981 3 TURNER 30 1981 08-Sep-1981 4 MARTIN 30 1981 28-Sep-1981 5 JAMES 30 1981 03-Dec-1981 6
-
Aggregation based on composite primary keys
Hello
I have a coherence cache which stores complex Java objects in the form of values in which I have to perform aggregation (County based on a composite primary key in the object). The key for the cache's UUID.
For example:
Class XYZ has properties a, b, c and d (all the java.lang.String type). I need to calculate the number of times a unique combination of values of a, b and c in the cache.
I tried to use a ReflectionExtractor as:
Then, create a chained as Exractor:ReflectionExtractor[] xBiz = {new ReflectionExtractor( "getA"),new ReflectionExtractor( "getB"),new ReflectionExtractor( "getC")};
Finally, I perform the aggregation such as:ChainedExtractor chExtractor = new ChainedExtractor(xBusinessService);
Obviously something is wrong, but I get the exception:InvocableMap.EntryAggregator aggregator = GroupAggregator.Parallel .createInstance( chExtractor, CompositeAggregator.Parallel .createInstance(new InvocableMap.EntryAggregator[] { new Count() }));
When I do this for the aggregation based on a single property say a or b or c, the aggregation works very well:java.lang.RuntimeException: Missing or inaccessible method: java.lang.String.getB()
with the resultInvocableMap.EntryAggregator aggregator = GroupAggregator.Parallel .createInstance( "getB", CompositeAggregator.Parallel .createInstance(new InvocableMap.EntryAggregator[] { new Count() }));
for the sample data below.y1 -> 4
The expected result for Aggregetion based on several properties:
Can anyone comment on how to get the aggregate first? And also if the way I am using the extractor chained is correct.Data in Cache: Expected Result: A | B | C | D | x1,y1,z1 -> 2 x1|y1|z1|Desc1| x2,y1,z1 -> 1 x2|y1|z1|Desc2| x3,y1,z2 -> 1 x1|y1|z1|Desc3| x3|y1|z2|Desc4|
Thanks in advance
Vikas
Edited by: vikascv January 6, 2010 17:59I think you want to use a MultiExtractor who will then produce a table of the elements of the composite key on which you can then aggregate. This means that the array of items produced key can be properly evaluated for equality.
If not, write a custom ValueExtractor which returns a single object (can be a concatenated string or a key object with equals/hashcode).
Regards, Paul
-
How to define a Composite primary key for a Table
Hello
I'm basically more in Java programming, with little knowledge of Oracle bit as DataBase .so please sorry for my silly doubts.
Can someone tell me please how to define a Composite primary key on a Table.
Thanks in advance.
Published by: user672373773 on 25 Sep, 2009 08:54Please go through these links:
http://plsqlworld.blogspot.com/2009/01/oracleplsql-composite-primary-key.html
http://sqlzoo.NET/HOWTO/source/z.dir/tip241027/Oracle
Concerning
Asif Kabir-Mark the response as correct/good
-
How to create validation of business for a composite primary key
Hi all
I am newbie in oracle ADF and my knowledge is lacking in the validation of the company,
My requirement is to display an error message when the user enter the same data into the table.
Let me exaggerate I have a table which the composite primary key is defined on 2 columns, if the user does not have the composite primary key constraints, so I have to display the warning message.
FYI, I use the version of Jdeveloper 11.1.2.3.0
Please let me know the steps to create business for this rule.
Thank you very much!!
User, if you use adfbc, you have nothing to do because this behavior out of the box. When you create a model of your tables infrastructure creates the business rule for you.
Timo
-
identification of composite primary keys
Hi mates,
I am trying to identify a unique value in a particular table, so then I tried to look for the primary key of the table constraints:
11:54:07 brunos@vvp > select constraint_name, constraint_type, index_name, owner of dba_constraints where table_name = 'CARD_TRANSACTIONS ';
OWNER CONSTRAINT_NAME, CONSTRAINT_TYPE INDEX_NAME
------------------------------ ------------------------------ --------------- ------------------------------
VVP PK_CARD_TRANSACTIONS P PK_CARD_TRANSACTIONS
Then I looked at dba_cons_columns:
11:56:22 brunos@vvp > select * from dba_cons_columns where constraint_name = "PK_CARD_TRANSACTIONS";
OWNER CONSTRAINT_NAME TABLE_NAME COLUMN_NAME POSITION
------------------------------ ------------------------------ ------------------------------ --------------------------------------------------
VVP PK_CARD_TRANSACTIONS CARD_TRANSACTIONS CARD 4
VVP PK_CARD_TRANSACTIONS CARD_TRANSACTIONS METER 3
VVP PK_CARD_TRANSACTIONS CARD_TRANSACTIONS 2 OPERATION
VVP PK_CARD_TRANSACTIONS CARD_TRANSACTIONS STATE 1
I understand that in a single table, we have only 1 PK only. It is a composite primary key? I expected to see 1 single value, and then he showed me 4.
Thanks in advance.
Published by: BSalesRashid on 06/29/2012 07:58It is a Composite key, you can see the column in position to observe order in the Composite key.
Rgds,
Ahmer
Published by: Ahmer Mansoor on June 29, 2012 20:02
-
A composite primary key column cannot be null
Hi all
It will be a silly question, but still, I would like to ask if a composite primary key column can be null?
Thank you
Rafi.Rafi,
Why you think he would be allowed?
SQL> drop table test purge; drop table test purge * ERROR at line 1: ORA-00942: table or view does not exist SQL> create table test as select * from dba_objects; Table created. SQL> alter table test add primary key(object_id, owner); Table altered. SQL> insert into test(object_id, owner) values(null, 'aman'); insert into test(object_id, owner) values(null, 'aman') * ERROR at line 1: ORA-01400: cannot insert NULL into ("SYS"."TEST"."OBJECT_ID") SQL> insert into test(object_id, owner) values(1,null); insert into test(object_id, owner) values(1,null) * ERROR at line 1: ORA-01400: cannot insert NULL into ("SYS"."TEST"."OWNER") SQL>
HTH
Aman... -
disable the primary key with waterfall
Hello everyone,
I just want to know
1. What is the effect after we diasble cascade a constraint primary key with the option?
2 should rebuild us the index after you have enabled the constraint? How?
Please explain with an example...
Thanx2 should rebuild us the index after you have enabled the constraint? How?
The index will be re-created for you automatically when you enable constraint even once:
SQL> create table t (i integer constraint t_pk primary key) / Table created. SQL> select index_name, uniqueness from user_indexes where table_name = 'T' / INDEX_NAME UNIQUENES ------------------------------ --------- T_PK UNIQUE 1 row selected. SQL> alter table t disable primary key cascade / Table altered. SQL> select index_name, uniqueness from user_indexes where table_name = 'T' / no rows selected. SQL> alter table t enable primary key / Table altered. SQL> select index_name, uniqueness from user_indexes where table_name = 'T' / INDEX_NAME UNIQUENES ------------------------------ --------- T_PK UNIQUE 1 row selected. SQL> drop table t / Table dropped.
-
I have CS5 with two computers under license, and a pc no longer works. How can I put CS5 on my new laptop with a valid license?
You will need to contact Adobe to reset your license.
Maybe you are looking for
-
This module requires a Lynxmotion AL5A robotic using LabVIEW arm control
Hello world I'm a little confused about what NI LabVIEW toolkits to be used in order for me to program the arm Lynxmotion robotic. Somebody has arms lynxmotion robot programming experience using labview? What should be awared by selecting the correct
-
Sony A55 vs Device Stage via USB, not enough of work
Sony A55 digital camera (or more correctly the SLT-A55V United States w / GPS) has two modes of operation for its USB connection: PTP and mass storage. This question is about its use in mode PTP with Device Stage. Compatibility Center lists the A55
-
Where you can disable the message of Lenovo A2010 vibrate function
Someone gave me a Lenovo 2010 as a gift which is already on Lolipop 5.1, GUI is a little different on my old A5000, that drives me crazy... Any idea on where I can find the option to disable vibrate when typing the SMS? Can't seem to find out where..
-
Recovery disk - WIN 8 PRO version
Hello everyone Pls forgive me, but I'm new here. ALSO many FRUSTRATED by this 'State' I'm in. (1) > = story I bought a HP ENVY laptop (not touch smart) of HP OUTLET store in December 2013. Yes, it was cheaper and come with a 90 DAY warranty. Teh lapt
-
How can I change the eyes of pets in the Gallery of windows?
How can I remove the white animal eyes in windows media?