im trying to use the createwithparm method programmatically in adf
to insert new record in the database but it doesnt works
i have db table with 2 generated values with before insert triggers
and i will pass 2 values
and this is my code
OperationBinding operation = ADFUtils.findOperation("CreateWithParams");
Object result = operation.execute();
and from the edit action binding I've referenced the 2 values i want to pass
{pageFlowScope.userBean.investorNumber}
{pageFlowScope.userBean.tempCode}
but nothing is inserted in the database
and there is nothing in the log
Given that you said "nothing is inserted into the database", I have to ask: Do you understand how ADF BC(EO, VO, AM) works? When you submit a page, for example with createwithparam, it updates the EO and VOs in the ADF BC middle tier model, in memory. Nothing is written to the database. You must issue a COMMIT through the enclosing Application Module to get the data written to the db.
This might help.
Related
I'm learning Spring, trying to work with a server (MySQL), created a server using MOMP, connected to the project, but when I try to open the page where the server is used, I get an undefined error. The only difference between my project and the tutorial's project is that there the table is created without "_seq" and there are properties in "structure".
How do I add a table to the database using MySQL, so that it does not turn into a "*_seq"?
That is the value SQL will use to auto increment keys for tables that contain id fields that are auto-generated (say, by hibernate). The typical value is 1, which means each auto-generated id will simply be the next integer. I assume you have a library managing your db instance.
See this related post -- Why is MySQL creating tables with a _seq suffix?
See this simple example here -- https://www.mysqltutorial.net/mysql-sequence/
Cheers!
I have a Main Table named REF_SERVICE_OFFERING where-in I already have 3 Million+ data. Now, I wanted to update the 3M records in Java based on some specific condition.
We decided to create a temporary table (where-in the records within will be used to Update the Main Table) and using the below query to Update the Main Table. The temporary table will hold more than 200k records :
UPDATE REF_SERVICE_OFFERING SET
PART_PRICE_BILL_TYPE= TEMP.PART_PRICE_BILL_TYPE,
part_price_unit_type=TEMP.part_price_unit_type,
part_price_allowed_units=TEMP.part_price_allowed_units,
part_price_discount=TEMP.part_price_discount,
part_price_source_id=TEMP.part_price_source_id
FROM REF_SERVICE_OFFERING RSO JOIN ref_offer_temp1 TEMP
ON TEMP.RECORD_NUM = RSO.RECORD_NUM
AND TEMP.SO_NAME = RSO.SO_NAME
AND TEMP.SERVICE_CASE_TYPE = RSO.SERVICE_CASE_TYPE
AND TEMP.WORK_ORDER_TYPE = RSO.WORK_ORDER_TYPE
WHERE (RSO.PART_PRICE_BILL_TYPE IS NOT NULL OR TRIM(RSO.PART_PRICE_BILL_TYPE) NOT LIKE '')
AND (RSO.PART_PRICE_EXCP_SOURCE_ID IS NOT NULL OR TRIM(RSO.PART_PRICE_EXCP_SOURCE_ID) NOT LIKE '')
Our database is Postgres 9.6. But this update is taking a lot of time and never edning. We also tried dumping only 10k records in the temporary table which will be used to update 4L records.
We tried doing EXPLAIN command and couldnt figure out the reason why.
Any help would be really appreciated.
I have 2 different databases one is MYSQL other is Oracle.Each have 1 table with different name and different columns name.Now I have to perform some db opeartions on each db from a single java application.Suppose for MYSQL db I have Emp table with columns Id,Name,Dept and for Oracle db I have Student table with StudentName and StudentDept.Now without changing code how can I manage 2 dbs?If I mention all db connection related data(connection url,username,password) in a properties file but to execute query I have to mention table name and column name in code.How can I manage it dynamically without altering the code so that in future any new db with different table name and column name is added I can only add the new one in properties file and no need to touch the code.Please suggest.
This might not be the prettiest, but one way to do this:
On application launch, parse properties files to get all DB connections. Store these however you want...List of connection pools, list of single connections, list of connection strings, etc...it doesn't matter.
Run a predefined stored procedure or select query to retrieve all table names from each database found in step 1. In sybase you can do this with
select name from sysobjects where type = 'U'
Build a Map where the key is the table name and the value is either the DB name, connection, connection string, or whatever you are using to manage your DB connections from the result set of #2. Anything that can be passed to your DB connection manager to identify which database it should connect to will work as the value.
In code, when table name is passed, lookup the required DB in the map
Execute query on returned DB Info in the map you created in step 3
As long as the tables are distinct in each DB this will work. Once this is setup, new DBs can be added to the properties file and the cache can be refreshed with an application restart. However, if new tables/columns are being sent to the code, how are these being passed without any code change?
i am trying to get all the data from a certain table.but it's only giving me only the first row twice a result (as i have two rows in the database)
here is my code
String data[]=new String[10];
String[] result;
Product p= new Product();
int serial=0;
try{
String sql="select * from product";
rslt=st.executeQuery(sql); //where private static Statement st, private static ResultSet rslt;
while(rslt.next()){
data[1]=rslt.getString("p_code");
data[2]=rslt.getString("p_name");
/* data[3]=rslt.getString("description");
data[4]=rslt.getString("measurement");
data[5]=Integer.toString(p.RemainProduct(data[1]));
data[6]=p.getSellPrice(data[1]);
serial+=1;
data[0]=Integer.toString(serial);
DTB.addRow(data); */
System.out.println("code :"+data[1]+" "+"Name :"+data[2]);
}
}catch(Exception ex){
System.out.println("ERROR :"+ex);
}
my table has two data, here is my database table data
and here is the result after i run the program.
i don't know where is the actual problem. the same code works fine on the other method but why i can't get it here. i am very new to java, please help me fixing this problem
Your code looks correct to me. I think this is a case of "what you are looking at is not what is broken". Perhaps you are not querying the table you think you are querying, or perhaps your table view is cached and out of date. Refresh your table view, and try printing out the PK (id column in the table) in your program output as a double check that the table your are querying is the correct table. Also, double check your JDBC URL and verify you are querying the correct database.
Also, your comments indicate that the same code is giving correct results in a different method. Maybe there is more going on in your actual code that we don't have insight into? Perhaps your code (not shown in your example) is:
Updating the table so that row 1 and 2 have the same data.
Querying the database (as shown in your example), and returning same data in row 1 and 2.
Update the table so that row 1 and 2 now have different data which shows up when you manually query the database.
Finally, make sure some of your other team members or an automated test process isn't updating the table without your knowledge.
I have a problem very similar to this question :
Oracle ADF web browser refresh button gets old page
My application is also running on top of a MySQL database. I have a table named IncidentType which contains 2 columns :
IncidentTypeID (int, auto_increment)
Description (varchar 60)
In my web page, I can create new records and commit them to the database. However, the IncidentTypeID will not be shown until I reload the page (via a "refresh" or close then reopen the page). Essentially, not until the VO's query is executed again on the database.
If I look at the data in the database, the IncidentTypeID is correctly assigned.
I noticed the same behaviour on the ADF Business Component tester.
What would you advice to modify to force the query to be re-executed after each commit and ?
I tried the solutions in the link above, but it didn't changed the behaviour.
I'm using jDev 11.1.2.3.0
See the unsupported features and "Set Up Primary Key Generation " workaround here:
http://www.oracle.com/technetwork/developer-tools/jdev/multidatabaseapp-085183.html