Auto increment cache
Hi all.
I have employee table which has around 65 million record. Each day around 35k records get inserted into this table. Now if we cache the report which includes this table then the report runs faster, but the next day again the report would take long to run or say if a user creates his own report which includes this table even then there will be a issue with the performance. So during the daily purge can we do something like we don't purge the cache instead do a incremental updated to the cache based on the fresh data which is been to dumped to the database after the daily ETL run?
please help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Hi,
In your scenario please implement event pooling in obiee.
You can refer the below link also
http://obiee101.blogspot.com/2008/07/obiee-managing-cache-emptyingpurging.html
http://gerardnico.com/wiki/dat/obiee/event_table
Hope this help's
Thanks
Satya
Similar Messages
-
Hello,
I've created some JSP pages with JDeveloper. When I want to create a new record in a table, then have I to fill in an unique ID for this record. Is it possible to get this field automatically filled in with an unique ID ? With Oracle, it's not possible to have an auto increment field. The solution I know, is to use a sequence and a trigger. But I doesn't want to use a trigger. Is there an other possibility ?
Greetz, JorisIt works! I've created a trigger to call the sequence to the primary key field and now it's populating that column properly.
Just one more doubt about it: I've imported some data from my old Access 2003 database to the new XE database, but when I insert a new record in the table, my sequence doesn't retrieve the last value from the primary key column + 1, it's recording straight from position 1 forward. The sequence created automatically during db migration is this one:
CREATE SEQUENCE "LOG_ID_LOG_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE
The problem with this sequence is that it doesn't see that I've migrated some data to this table before using it, so it's starting with value 1. How can I alter this sequence so it will always get the last (highest) value from my PK column + 1 before interting a new record to the table?
Thanks again!
Regards,
Roger. -
Auto increment sequence problem
Hi,
Is there any particular thing about 21st record because, when i insert data into same or different table, records start from 21 instead of 1 or where it was finished before.
Example : I leave a table with 3 records. Come back, I insert data into same table then, auto increment starts from 21 not the 4!!!
Thanks
CREATE SEQUENCE FRANC_AUTOINC_SEQ
START WITH 1
INCREMENT BY 1
NOMAXVALUE;
CREATE TRIGGER FRANC_AUTOINC_TRG
BEFORE INSERT ON FRANCHISE
FOR EACH ROW
BEGIN
SELECT FRANC_AUTOINC_SEQ.NEXTVAL INTO :NEW.FRANCHISEID FROM DUAL;
END;Hi,
There's no need to do anything.
If you want fewer numbers to be discarded in the future, you can make the cache size smaller, or remove it entirely, as in:
CREATE SEQUENCE FRANC_AUTOINC_SEQ
START WITH 1
INCREMENT BY 1
NOMAXVALUE
NOCACHE;This may mean slightly less efficiency, since (to use my earlier analogy) you have to go to the number store and buy a new box every time you need a number, rather than going to the store once and not having to go back again until you've used up the box of twenty numbers. If you rarely use more than one new number in a session, the loss in efficiency will be insignificant.
Regardless of the caching, if only one session is using the sequence, you will get consecutive numbers in that session. If NOCACHE is in effect, and you are the only person using the sequence, you will get consecutive numbers even if work over multiple sessions.
Ending the session is what causes the cached numbrs to be discarded. Shutting down the database implies ending all sessions, but otherwise has nothing to do with the sequence.
Message was edited by:
Frank Kulash -
Trigger Bad Bind Value Auto Increment
I am new to the Oracle world and am trying to make the switch from MySQL so my apologies if this seems like a silly question.
I am trying to figure out what is wrong with my trigger code. Basically , I am trying to create an auto-increment solution using some example code I found on the Internet.
I have a fairly simple table structure:
CREATE TABLE "CIMS"."computerSoftware"
( "computerSoftware_id" NUMBER(11,0),
"cid" NUMBER(11,0) DEFAULT 0 NOT NULL ENABLE,
"publisher" VARCHAR2(100 CHAR) DEFAULT NULL,
"name" VARCHAR2(100 CHAR) DEFAULT NULL,
"version" VARCHAR2(100 CHAR) DEFAULT NULL,
"serialNumber" VARCHAR2(100 CHAR) DEFAULT NULL,
"unlimited" NUMBER(4,0) DEFAULT 0,
"copies" NUMBER(9,0) DEFAULT 1 NOT NULL ENABLE,
"master" NUMBER(4,0) DEFAULT 0,
PRIMARY KEY ("computerSoftware_id")
My Trigger looks like this:
CREATE OR REPLACE TRIGGER "CIMS"."TR_CompSoftware_ID"
BEFORE INSERT ON CIMS."computerSoftware"
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
BEGIN
IF (:new.computerSoftware_id IS NULL) then
SELECT S_CompSoftware_ID.NEXTVAL
INTO :new.computerSoftware_id
FROM dual;
end IF;
END;
And finally, here is my sequence:
CREATE SEQUENCE "CIMS"."S_CompSoftware_ID" MINVALUE 1
MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 10 NOORDER NOCYCLE
When I try to save the trigger I receive the following error:
PLS-00049: bad bind variable 'NEW.COMPUTERSOFTWARE_ID'
Any help is much appreciated!
TomAnd, this is the way - you can rectify this problem ->
satyaki>
satyaki>drop table "computerSoftware";
Table dropped.
Elapsed: 00:00:00.92
satyaki>
satyaki>CREATE TABLE computerSoftware
2 (
3 computerSoftware_id NUMBER(11,0),
4 cid NUMBER(11,0) DEFAULT 0 NOT NULL ENABLE,
5 publisher VARCHAR2(100 CHAR) DEFAULT NULL,
6 name VARCHAR2(100 CHAR) DEFAULT NULL,
7 version VARCHAR2(100 CHAR) DEFAULT NULL,
8 serialNumber VARCHAR2(100 CHAR) DEFAULT NULL,
9 un_limited NUMBER(4,0) DEFAULT 0, -- Need to change the name of your column due to use of reserve word
10 copies NUMBER(9,0) DEFAULT 1 NOT NULL ENABLE,
11 master NUMBER(4,0) DEFAULT 0,
12 constraints pk_cid PRIMARY KEY (computerSoftware_id)
13 );
Table created.
Elapsed: 00:00:00.20
satyaki>
satyaki>
satyaki>CREATE SEQUENCE S_CompSoftware_ID MINVALUE 1
2 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 10 NOORDER NOCYCLE;
Sequence created.
Elapsed: 00:00:00.05
satyaki>
satyaki>
satyaki>CREATE OR REPLACE TRIGGER TR_CompSoftware_ID
2 BEFORE INSERT ON computerSoftware
3 REFERENCING OLD AS OLD NEW AS NEW
4 FOR EACH ROW
5 BEGIN
6 IF (:new.computerSoftware_id IS NULL) then
7 SELECT S_CompSoftware_ID.NEXTVAL
8 INTO :new.computerSoftware_id
9 FROM dual;
10 end IF;
11 END;
12 /
Trigger created.
Elapsed: 00:00:00.98
satyaki>
satyaki>insert into computerSoftware(cid,publisher,name,version,serialNumber,un_limited,copies,master)
2 values(1,'ABP','SR','1.0.0.1','1.4.3',88,7,9);
1 row created.
Elapsed: 00:00:00.14
satyaki>
satyaki>commit;
Commit complete.
Elapsed: 00:00:00.05
satyaki>
satyaki>
satyaki>select * from computerSoftware;
COMPUTERSOFTWARE_ID CID PUBLISHER NAME VERSION
1 1 ABP SR 1.0.0.1
Elapsed: 00:00:00.05
satyaki>Got me?
Regards.
Satyaki De. -
How to use auto-increment and search option for MS Access DB
Dear All,
I have configured our invoice in Adobe Livecycle and connected it to MS Acess 2007 as per http://forms.stefcameron.com/2006/09/18/connecting-a-form-to-a-database/.
All is working fine, I can insert, retrieve data from DB to invoice and vice versa.
Now I want few things to be implemented on our invoice.
When ever I open our invoice, it populate the first entry from DB, Is it possible to populate the last entry ?
Auto increment invoice number from MS Access DB every time we open our invoice after save.
How to implement search option from DB for invoice number ?
Please let me know if someone can provide me help on my scenario, so that I can share more stuff related to invoice and DB.
Look forward to hearing soon from experts and other team members.
Thanks & Regards
Riyad...As far as I know there is not any auto increment data type in Oracle. Instead of this you should create a sequence and get the next value of the sequence while creating a row in your table.
CREATE SEQUENCE Test_Sequence ;
CREATE TABLE Test_Table ( Id NUMBER , Foo VARCHAR2(4) ) ;
ALTER TABLE Test_Table ADD CONSTRAINT Test_Table_PK_Id PRIMARY KEY ( Id ) ;
INSERT INTO Test_Table ( Id , Information ) VALUES ( Test_Sequence.NEXTVAL , 'FOO' ) ; -
Trying to create cmp correctly(auto-increment);error while running
I am using the latest versions of Jboss(4.0.5.GA) and Lomboz(R-3.2-200610201336) along with SQL Server 2005 and Microsoft's SQL Server 2005 JDBC driver.
Lomboz used xdoclet to create the java files based on the SQL table but it did not put anything in the DoctorBean.java file telling it that the primary key was auto-incremented.
Using the JSP files, I can retreive data out of the database fine so I know the connection and drivers are set up properly.
Here is the error:
09:16:46,815 WARN [ServiceController] Problem starting service jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at org.jboss.mx.loading.RepositoryClassLoader.loadClassLocally(RepositoryClassLoader.java:197)
at org.jboss.mx.loading.UnifiedLoaderRepository3.loadClassFromClassLoader(UnifiedLoaderRepository3.java:277)
at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:284)
at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:511)
at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:405)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:89)
at org.jboss.mx.loading.LoaderRepositoryClassLoader.loadClass(LoaderRepositoryClassLoader.java:90)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:89)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityCommandMetaData.<init>(JDBCEntityCommandMetaData.java:73)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.<init>(JDBCEntityMetaData.java:952)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.<init>(JDBCApplicationMetaData.java:378)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:89)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:736)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:424)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:368)
at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:172)
at org.jboss.ejb.EjbModule.startService(EjbModule.java:414)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy25.start(Unknown Source)
at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:662)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy26.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy8.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
at org.jboss.Main.boot(Main.java:200)
at org.jboss.Main$1.run(Main.java:490)
at java.lang.Thread.run(Unknown Source)
09:16:46,862 INFO [EJBDeployer] Deployed: file:/C:/java/jboss-4.0.5.GA/server/default/deploy/MedicalEJB.jar
09:16:46,987 INFO [TomcatDeployer] deploy, ctxPath=/MedicalWeb, warUrl=.../tmp/deploy/tmp63256MedicalWeb-exp.war/
09:16:47,315 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
09:16:47,503 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
State: FAILED
Reason: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
State: FAILED
Reason: java.lang.StringIndexOutOfBoundsException: String index out of range: 01Simple Doctor table:
CREATE TABLE [dbo].[Doctors](
[DoctorId] [int] IDENTITY(1,1) NOT NULL,
[firstName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[lastName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [PK_Doctors] PRIMARY KEY CLUSTERED
[DoctorId] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]Most of DoctorBean.java was createded automatically with xdoclet, I created these items manually but with no success:
* @jboss.entity-command
* name="mssql-get-generated-keys"
* @jboss.unknown-pk
* class="java.lang.Integer"
* column-name="doctorid"
* field-name="doctorid"
* jdbc-type="INTEGER"
* sql-type="int"
* auto-increment="true"DoctorBean.java:
package com.bdintegrations.MedicalApp.EJB;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;
* <!-- begin-xdoclet-definition -->
* @ejb.bean name="Doctor"
* jndi-name="Doctor"
* type="CMP"
* primkey-field="doctorid"
* schema="DoctorSCHEMA"
* cmp-version="2.x"
* @ejb.persistence
* table-name="dbo.Doctors"
* @ejb.finder
* query="SELECT OBJECT(a) FROM DoctorSCHEMA as a"
* signature="java.util.Collection findAll()"
* @ejb.pk
* class="java.lang.Object"
* generate="false"
* @jboss.entity-command
* name="mssql-get-generated-keys"
* @jboss.unknown-pk
* class="java.lang.Integer"
* column-name="doctorid"
* field-name="doctorid"
* jdbc-type="INTEGER"
* sql-type="int"
* auto-increment="true"
* @jboss.persistence
* datasource="java:/MSSQLDS"
* datasource-mapping="MS SQLSERVER2005"
* table-name="dbo.Doctors"
* create-table="false" remove-table="false"
* alter-table="false"
* <!-- end-xdoclet-definition -->
* @generated
public abstract class DoctorBean implements javax.ejb.EntityBean {
* <!-- begin-user-doc -->
* The ejbCreate method.
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.create-method
* <!-- end-xdoclet-definition -->
* @generated
public java.lang.Object ejbCreate(String firstName, String lastName) throws javax.ejb.CreateException {
setFirstname(firstName);
setLastname(lastName);
return null;
// end-user-code
* <!-- begin-user-doc -->
* The container invokes this method immediately after it calls ejbCreate.
* <!-- end-user-doc -->
* @generated
public void ejbPostCreate() throws javax.ejb.CreateException {
// begin-user-code
// end-user-code
* <!-- begin-user-doc -->
* CMP Field doctorid
* Returns the doctorid
* @return the doctorid
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.persistent-field
* @ejb.persistence
* column-name="DoctorId"
* jdbc-type="INTEGER"
* sql-type="int identity"
* read-only="false"
* @ejb.pk-field
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
public abstract java.lang.Integer getDoctorid();
* <!-- begin-user-doc -->
* Sets the doctorid
* @param java.lang.Integer the new doctorid value
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
public abstract void setDoctorid(java.lang.Integer doctorid);
* <!-- begin-user-doc -->
* CMP Field firstname
* Returns the firstname
* @return the firstname
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.persistent-field
* @ejb.persistence
* column-name="firstName"
* jdbc-type="VARCHAR"
* sql-type="varchar"
* read-only="false"
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
public abstract java.lang.String getFirstname();
* <!-- begin-user-doc -->
* Sets the firstname
* @param java.lang.String the new firstname value
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
public abstract void setFirstname(java.lang.String firstname);
* <!-- begin-user-doc -->
* CMP Field lastname
* Returns the lastname
* @return the lastname
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.persistent-field
* @ejb.persistence
* column-name="lastName"
* jdbc-type="VARCHAR"
* sql-type="varchar"
* read-only="false"
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
public abstract java.lang.String getLastname();
* <!-- begin-user-doc -->
* Sets the lastname
* @param java.lang.String the new lastname value
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
public abstract void setLastname(java.lang.String lastname);
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbActivate()
public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbLoad()
public void ejbLoad() throws EJBException, RemoteException {
// TODO Auto-generated method stub
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbPassivate()
public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbRemove()
public void ejbRemove() throws RemoveException, EJBException,
RemoteException {
// TODO Auto-generated method stub
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbStore()
public void ejbStore() throws EJBException, RemoteException {
// TODO Auto-generated method stub
/* (non-Javadoc)
* @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
public void setEntityContext(EntityContext arg0) throws EJBException,
RemoteException {
// TODO Auto-generated method stub
/* (non-Javadoc)
* @see javax.ejb.EntityBean#unsetEntityContext()
public void unsetEntityContext() throws EJBException, RemoteException {
// TODO Auto-generated method stub
public DoctorBean() {
// TODO Auto-generated constructor stub
}JSP client page snippet:
<%
DoctorHome home = DoctorUtil.getHome();
Doctor doctor = home.create("Jon","Smith");
%>
<%=doctor.getDoctorid() %>thanksNevermind.. no one bothered to inform the developer that the path to the collection AND the path to the directory that the collection is for are different on this other server.
Fixed. -
Auto increment with collection is not working
I am using KODO 3.0 with MYSQL 4.0.16. I have created two JDO object as
follows
BankAccount contains a collection of Contacts object. My metadata looks
like this
<class name="BankAccount">
<field name="contacts">
<collection element-type="Contacts"/>
<extension vendor-name="kodo" key="element-dependent"
value="true"/>
</field>
</class>
<class name="Contacts" objectid-class="Contacts$contactId">
<field name="contactId" primary-key="true">
<extension vendor-name="kodo" key="jdbc-auto-increment"
value="true"/>
</field>
</class>
There is no problem in the persisting of BankAccount object and adding
Contacts to it, but Contacts collation is not retrieved along with parent
object. In the database join table, the contact Id value it is always set
to null.
Things are working well with out contact id in Contacts.
Can anyone help?
Regards,
dharmiSet the following property:
kodo.jdbc.AutoIncrementConstraints: true
Described here:
http://www.solarmetric.com/Software/Documentation/latest/docs/ref_guide_pc_oid.html#ref_guide_pc_oid_pkgen_autoinc -
How can i create an auto increment column
Hello Everyone
We are working on an EAM package which has an auto number facility but that is not meeting our requirement because some 10s and 100s of numbers keep on jumping based on the number of records the child table has.Means every record in my parent table will have some child records in another table which we call it a child table.The number of numbers that will be jumped each time will depend on the number of child records it has. Now we want to create a new column and generate a sequential unique number in my parent table with out linking it to its child table and use this number as a reference number. And we cant do that through our package customization. Can any one guide us if we can meet our requirement through oracle triggers or so.
Thanks and RegardsHi,
For "Auto-Increment" functionality - you can use a combination of a sequence and a trigger like so:
create table roles ( role_id INT
, role_name VARCHAR2(30) NOT NULL
, creation_date DATE DEFAULT SYSDATE NOT NULL
, role_description VARCHAR2(255)
, CONSTRAINT roles_pk PRIMARY KEY (role_id)
, CONSTRAINT roles_uk1 UNIQUE (role_name)
create sequence role_id_seq
start with 1
increment by 1
nocache;
CREATE OR REPLACE TRIGGER roles_pk_trig
BEFORE
insert on roles
for each row
begin
IF :new.role_id IS NULL THEN
SELECT role_id_seq.NEXTVAL
INTO :new.role_id
FROM dual;
END IF;
end;
/Now any insert which leaves the "ROLE_ID" column NULL will have an auto-incremented value put in for that column. This is similar to an "Autonumber" column in Access.
Hope this helps...
Take care. -
Auto Increment of Primary Field in Table Maintainance
Hi,
We want to give an Auto increment to the Primary Key, when ever the table is updated/inserted with a new record. How to get the value updated????
For Eg,
Table ZTEST Contains MANDT, ITEM, EBELN.
It should have the values 800 001 000977
And when the next record is created, the ITEM value should be Automatically get the value 002.. and so on for every Record.
Pls do let me know if any other details is reqd.
Thanx in Advance.
AjazDear Syed,
You can do many things in table maintenance screen like validation of some field, making some field required or displayed etc.
For auto increment you have to use Number-Ranges. FM NUMBER_GET_NEXT is helpful in this case.
Where to write the code??? The Function-Group you have made. There will be includes. You can easily locate the place to write these codes.
Caution point is that if you re-generate the table maintenance then all code will be gone.
Regards,
Deva. -
HSQL DB Identity & Auto Increment
We are trying to write records to this table:
create table location_groups
group_id identity
,jdoversion integer
,jdoclass varchar(255) default 'path.impl.LocationGroup' not null
,group_name varchar(100) not null
,group_parent_id integer
Package.jdo is:
<package name="path">
<class name="LocationComponent">
</class>
</package>
<package name="path.impl">
<class name="LocationGroup" persistence-capable-superclass="path.LocationComponent">
<!--<extension vendor-name="kodo" key="jdbc-field-map" value="one-one"/>-->
<extension vendor-name="kodo" key="jdbc-auto-increment" value="true"/>
<field name="children" persistence-modifier="persistent" default-fetch-group="true">
<collection element-type="path.impl.Location"/>
</field>
</class>
and package.mapping is:
<package name="path">
<class name="LocationComponent">
<jdbc-class-map type="horizontal"/>
</class>
</package>
<package name="path.impl">
<class name="LocationGroup">
<jdbc-class-map type="base" pk-column="GROUP_ID" table="LOCATION_GROUPS"/>
<jdbc-version-ind type="version-number" column="JDOVERSION"/>
<jdbc-class-ind type="in-class-name" column="JDOCLASS"/>
<field name="path.LocationComponent.name">
<jdbc-field-map type="value" column="GROUP_NAME"/>
</field>
<field name="children">
<jdbc-field-map type="one-many" table="LOCATIONS" ref-column.GROUP_ID="GROUP_PARENT_ID"/>
</field>
</class>
</package>
I have tried all manner of configurations but the error remains the same:
25-Apr-2008 16:05:24 com.ea.albt.infrastructure.persistence.jdo.JDODataStore BeginTransaction
CONFIG: Starting transaction
25-Apr-2008 16:05:24 com.ea.albt.infrastructure.persistence.jdo.JDODataStore updateObjects
FINE: Updating object ALBT Loc1209135924484 (has not yet been persisted)
25-Apr-2008 16:05:25 com.ea.albt.infrastructure.persistence.jdo.JDODataStore updateObjects
WARNING: Failed to persist/update objectALBT Loc1209135924484
kodo.util.FatalDataStoreException: Attempt to update the sequence table "JDO_SEQUENCE" failed. The sequence table is typically created when you run the mappingtool's refresh action on any datastore identity class. If you have not run the mappingtool but want to create the sequence table, run:
java kodo.jdbc.schema.DBSequenceFactory -action add
NestedThrowables:
Why is Kodo trying to use the jdo_sequence table when we want it to use the HSQLdb identity field ?We have many users using single field identity and auto-increment together.
-
How to create auto increment value in my column using identity ?
hi Team,
I have an requirement where i create an auto increment value ,with my table column
Create table Temp(
DeptID int IDENTITY(1,1) PRIMARY KEY,
Name varchar(50),
Emailid nvarchar(50),
Phone varchar(50)
so this is my table structure ,Here my column name is
Deptid here i need to creat an autoincrement value with today's date like below
ex:STM0000120012015
STM0000221012015
STM0000322012015(Currentdate)
.......................................... like this
Here i need only one column like identity column with the given incremental order,not more than one column
so can u pls help me out any one.
Thanks!Here the output came like this ,
1 STM0000120150121
2 STM0000220150121
3 STM0000320150121
4 STM0000420150121
5 STM0000520150121
6 STM0000620150121
7 STM0000720150121
8 STM0000820150121
9 STM0000920150121
10 STM00001020150121 --see this exceed length
and here i dnt need to increment that Stm000010,Here my output will come like this, idnt need to increment my charcter size
1 STM0000120150121
2 STM0000220150121
3 STM0000320150121
4 STM0000420150121
5 STM0000520150121
6 STM0000620150121
7 STM0000720150121
8 STM0000820150121
9 STM0000920150121
10 STM0001020150121
11 STM0001120150121
12 STM0001220150121
so here i dont need to increment my charcter length(16)
The length should be STM(3char)+00001(5Charcters)+CurrentDateFormat,
see the above suggested o/p
so can u pls help me out Dimant -
Auto-increment column increase performance in this case ?
hi.
i have the following facts to construct a set of tables.
1. A Lecturer has an ID, Name and Date Joined
2. A Classroom has an ID, Number Of Students
3. A Lecturer can Teach in Many Classes
4. A Class Can be lectured by Many Lecturers
5. Each Lecture Date should be Stored in the DB.
considering those facts, the following schema can be derived
Lecturer
(Lecturer_ID (PK), Lecturer_name, Date_Joined)
Classroom
(Classroom_ID (PK), NumOfStudents)
Class_Lectures
(Classroom_ID, Lecturer_ID (Composte PK), LectureDate)
this is the normal practice we do.
but what if the 3rd Table is constructed as follows ?
Class_Lectures
(LectureSeriesID (Auto-Increment, PK), Classroom_ID, Lecturer_ID (Composte Unique Key), LectureDate)
if the 3rd Table is created as above, will there be any performance differences ? will the performance improve or get reduced ? any advantages / disadvantages of having that structure ?
please do advise my any further best practices as well.
Thanks and Regardshttp://technet.oracle.com:89/ubb/Forum88/HTML/000944.html
null -
Filename generation & Auto increment filename
Hi,
I would like my program to create a filename automatically, im using the "Filename Generator" which was available online, and also the "Unique Filename" VI. The way im using this is, I let the user select a path, and feed the path to the filename generator.vi. The output of that VI is the input to the Unique filename.vi .And the output of this VI is the root where the actual output file will be located. Im getting an error:
Error 7 occurred at Open/Create/Replace File in Write Spreadsheet String.vi->Write To Spreadsheet File (string).vi->Write Header & Waveform Ref.vi->Main.vi
I have attached my main VI, and the two above mentioned VIs. Also attached is the png file of the frames that contains these functions.
Is there a way to get over this???
Thank you,
Eureka
Solved!
Go to Solution.
Attachments:
Main.vi 111 KB
Filename Generator.llb 117 KB
Unique File Name.vi 35 KBI think i see what the problem is,
This function creates a path, but not a file. So, the input given to the write to spreadsheet file is not actually the location of a file, i would say it is something virtual.
If i use the Unique filename.vi alone and not the filename generator.vi, my program works fine, it does increment the filename, but, the user has to select the file every time.
For instance, i have a txt file "Current". The VI generates a file path for "Current(1)" and writes the data in the new file.
The next time, if the user fails to select "Current(1)" as the input path, and if the input path is just the same as the 1st run, it over writes the data in "Current(1)", as expected!
The basic problem is, i need to avoid over writing data. Because, i read the waveforms from the file and it will me messed up big time.
Is there a function to auto-increment filenames as we write them?
Thank you,
Eureka -
Auto-increment identity column through procedure in oracle 10g on windows
Hi,
I need identity primary key which should be auto increment before while inserting data into table.
for this i had use sequence and then trigger to increment it.
but now i need to increment it in Procedure, while my procedure is having code to insert data in same table which has primary keyHi,
SNEHA RK wrote:
Hi,
I need identity primary key which should be auto increment before while inserting data into table.
for this i had use sequence and then trigger to increment it.Right. Some database products have auto-increment columns, and they are really handy. Unfortunately, Oracle does not have auto-increment columns. A sequence is an auto-increment object, and it's the right way to automatically generate unique identifiers, but you need to explicity reference the sequence, either in you DML statements, or in a trigger that will automatically fire before a DML statement.
but now i need to increment it in Procedure, while my procedure is having code to insert data in same table which has primary keyAre you saying that you need to increment the sequence, completely aside from INSERTing into the table?
If so, just reference sequence_name.NEXTVAL wherever you want to. In PL/SQL, you can say
SELECT sequence_name.NEXTVAL
INTO number_variable
FROM dual;This works in any version of Oracle, but starting in Oracle 11, you also have the option of referencing te sequence without using dual, or any other table.
I hope this answers your question.
If not, post a complete script that people can run to re-create the problem and test their ideas.
For example:
-- Here are the table and the seqauence that I created:
CREATE TABLE table_x ...
CREATE SEQUENCE ...
-- Here is the BEFORE INSERT trigger I wrote:
CREATE OR REPLACE TRIGGER ...
-- The trigger works exactly how I want it to in statements like this:
INSERT INTO table_x ...
-- So there are no problems (that I know of) with anything up to this point.
-- Now I want to use the same sequence to ...
-- so that when I execute a statement like this
-- then the next time I add a new row to the orginal table, like this
INSERT INTO table_x ...
-- then the contents of table_x should be ... because ... -
Auto Incrementing in Text Field
I imported a tab file and one column was the city, state and zip code. For some reason, the Zip code auto increments. It just so happened that the first cell was Durham, NC 27701. All subsequent cells incremented the Zip code by one, so the second cell became Durham, NC 27702. I have tried making the column a text field, and that did not work. I do not find any formula in the field, so am at a loss as to how to prevent the auto-incrementing from hapening.
rha3675 wrote:
Which Vallauris is your home city? Provence, or Pyrenees?
None, Vallauris is not in Provence but in 'Provence-Alpes-Côte-d'Azur'
At this time there is a great discussion about this name.
Some wish to change it because they think that thge acronym PACA is not their cup of tea.
Given that, inhabitants of "Provence" refuse to drop "Provence",
inhabitants of "Alpes" refuse to drop "Alpes",
inhabitants of "Cote d'Azur" refuse to drop "Cote d'Azur".
My own advice is simply : don't use an acronym !
I searched heavily and din't find a Vallauris in Pyrénées.
The only town whose name approach is :
I just found :
Valaurie
Code postal: 26230
Département: Drôme
Région: Rhône-Alpes
Vallauris sits between Cannes and Antibes.
Yvan KOENIG (VALLAURIS, France) mardi 2 février 2010 17:45:21
Maybe you are looking for
-
Screen turns black and shuts down unexpectedly- help!
screen turns black and shuts down unexpectedly- help!
-
Why won't my Safari 5.1.7 launch in Windows XP SP3?
I have spent most of the day today scouring these pages for a solution. I have followed myriad instructions written by B Noir and others. To no avail. Whenever I click the Safari icon, the hourglass appears for a few seconds, but the browser won't
-
Unable to connect to internal SSL sites with unknown CA's after 36.0 update.
Last week my browser auto-updated to version 36.0 and I am now no longer able to connect to certain internal corporate websites. These sites either have self-signed certs, or certs signed by an internal CA. They do not use certs signed by publicly kn
-
Page data does not load with goButton? (new window of identical page)
Hi guys. I ran into a problem. Essentially, I need to print a .jsff page but before I do, I have to alter its format a little bit. The solution I decided to use was to create a new .jspx page containing almost the exact same content. I even copied th
-
Hi Can anybody advise me on how i can create a form with two fields: The first field should allow me to select a record which already exists in my database (gameid) The second field should allow me to update a section of that record (gamereview) Also