How to create entity class from synonyms in oracle? - oracle

i can create entity class from available tables but i want to create entity from synonyms in my oracle which are not showing in my table list...
(i have used eclipse JPA tools to create entity class)
how to see synonyms and create entity

Whether Dali (the Eclipse plug-in that provides these JPA tools) can see and use table synonyms depends on the DTP extension you are using to access your database's metadata. If your synonyms show up in the Data Source Explorer under your database's "Tables" folder, they should show up in the Entity Generation wizard's list of tables. If they do not also show up in the wizard, that is a possible bug.
Note: There are some third-party extensions that do not want Dali to use synonyms. You might look at this bug from a few years ago: https://bugs.eclipse.org/bugs/show_bug.cgi?id=288027

Related

Using TOAD data modeler with existing TOAD Oracle

I need to start a long-term project in mapping out data tables so that we can get a high-level view of what information we store in our Oracle database and how the tables are linked to each other. This is largely for GDPR preparation.
Since our organization has been around for a number of decades, its database is massive. With TOAD for Oracle, I'm able to see all columns in our tables easily, so I started looking at different database mapping tools (ER/ONE, DDM, Astah) but they all look like I need to manually create all the tables and columns and draw their relationships out by hand.
I'm hoping to minimize as much manual labor as possible and am wondering if using TOAD data modeler would help since I'm using TOAD for Oracle anyways. Could I somehow automate the table, column, and relationship creation process?
Our organization only has Oracle's base version unfortunately (I think the premium bundle has data mapper included in it maybe... not sure.) Any thoughts on the options I have?
-
Bundle: Toad for Oracle Base (64-bit), Add-Ons: <-none->
Our organization only has Oracle's base version
Note: TOAD is not an Oracle product, it is owned and developed by Quest.
they all look like I need to manually create all the tables and columns and draw their relationships out by hand
Any decent data modelling tool supports reverse engineer a physical data model from an existing schema. How good the derived model is will depend on how good your schema is (my bet: decades of development without an existing data modelling tool? not good). For instance, if your schema has foreign keys the reverse engineering process will use them to draw the relationships between tables (even if they are disabled). But if there are no foreign keys then you're on your own.
As you're using already TOAD you are right to want the TOAD modelling extension. You can buy it as a standalone purchase. But if your company won't spring for the extra licenses you should check out Oracle SQL Developer Data Modeler. It's free and it has the most comprehensive support for idiomatic Oracle. (I'm not saying it's the best DM tool of them all but it's very good for something which is free). Find out more.

Public synonyms issue with two schemas on same instance

The database I am using is Oracle 11g Express Edition release 2.
I created 2 schemas in the same instance xe. They all have the same tables names and sequences names and stored procedures and stored functions and views names. But the tables structures and views texts are different ( there is some modifications between them ).
The reason for the creation of these two schemas is because our project has two versions. So the first schema is used for the first version , and the second schema was created for the second version. The mechanism of our web application Spring project is that whenever a connection is made through the web application login page then a corresponding Oracle user is making a connection according to the login entered ; so there is no fixed credential connection , there are Oracle users corresponding to each web application login.
So in order for each user to work with each database objects then I created public synonyms for every objects , and granted permissions to them for each user. But the database objects are owned by the schema I mentioned at the beginning. Now my problem is this : our customer wants the two project versions to be run on a same instance ( same computer server ). So one of the project version cannot run because the public synonyms can only refer to a particular schema owner. So how to make the public synonyms work for each schema ?
In short, you can't. However, you can always use a distinct synonym name to identify the object.
Something similar to below:
create public synonym structures_v1 for schema1.structures;
create public synonym structures_v2 for schema2.structures;
Oracle provides 2 totally different technologies for this situation (which comes to my mind):
Editions (and Edition Based Redefinition)
PDBs
With Editions you can create the same Object once in each Edition - but there are limitations like tables are not editionable.
It's not a feature you just enable, you need to understand the concept and implement it properly.
PDBs enable consolidation of Databases with colliding namespace (such as your described synonyms) within the same CDB and therefore save SGA/memory. Basically they are totally separated - limited interference can be implemented when it's concept of object & data inheritance is understand.
What about creating a 3rd Schema and having Synonym and permission to query 1st and 2nd schema. Anyone tested this concept?

ORACLE Application Development Framework

Hello I am trying to build an application using Oracle ADF.
I have designed my database using Oracle Workbench have all the tables in the database already linked.( be it one to many or one to one mapping with the primary and foreignm keys.) i hope to include triggers too.
My problem is when i do all these links in workbench.
Will it automatically link the tables up using Association when i I load the tables as entities.
Will it also create views and view links too for me.
Or i should just create the tables in the database and do the associations and links in jdeveloper instead when i start working on the UI of my project.
If you use New - Business Tier - ADF Business Components - Business Components from Tables and go through the wizard pointint your tables in the database, JDeveloper should create Entities, link them with Associations, also create View Objects and link them with View Links based on your tables' foreign keys.
Triggers won't be reflected in the application.

Not to drop database or tables with EF4.1?

Is there a way to make Entity Framework 4.1 Code First NOT to drop database or the tables, not even if its changed? Im suppose to upgrade a LIVE site and I cant because of this. I seen some NuGet classes I can get but its to not drop database but tables, recreate tables on change ect.. i just do not want to do anything to the database or the tables.
In the startup of your application add this:
Database.SetInitializer<YourContextType>(null);
This should remove any initialization strategy.

"Update Model From Database" does not work in .edmx Entities file. My Database is DB2

I am trying to reflect new changes or add a new table to my model in EDMX file using 'Update Model From Database.' Then i get this error message in Update Wizard saying "Error retrieving Database information. An Item with the same key has already been added."
I am using DB2 database and VS 2010.
Please let me know how i can add a new table or reflect the changes to my model with the changes made to the database. Right now i am deleting the entire model and recreating the new one.
Any help is appreciated.
I was getting this same error. In my case with DB2 9.5 LUW the solution was to remove duplicate named stored procedures on the server. DB2 lets you have multiple stored procs with the same name but different definitions (ie different parameters). But apparently this isn't compatible with Entity Framework. Fortunately for me the duplicates were actually unused old versions.
An alternative is to edit your EDM file in XML editor mode.
I have followed the solution provided by vikrantislav. And in addition to that, I made one more change. By default EF tool brings objects from all the exiting schemas. So make sure you don't have duplicate store procedures in any of those schemas or change the connection properties to filter out by a specific schema. In my case I have filtered out by specific schema as I don't want to mess up with someone else's store procedures in other schemas. And now "update model from database" wizard started working. what a relief.
Schema filter in connection properties window

Resources