How to combine two tables/view objects into one in JDeveloper? - oracle

I have the following tables/view objects:
StudentRequest
StudentApprovedRequests
I want to add a new StudentRequestHistory View object that simply combines both of these tables by displaying both of their content in one. This table is simply for visual/front end purposes, its does not exist in the database.
What I want is this:
StudentRequest View Object
StudentApprovedRequests View Object
StudentRequestHistory View Object
Really hope someone can help.
Thank you!

Define a VO based on a SQL query that uses the Union: https://docs.oracle.com/middleware/1213/adf/develop/adf-bc-vo-queries.htm

Related

linq to sql, how to define DataContext without specifying Table properties

My intent is to create a generic (not in C# meaning) database model for Windows Phone using linq to sql. User of such model should be able to pass an array of his data object types (classes marked with Table attribute) to model's contstructor, and then model should take care about adding related tables to database and provide API for CRUD operations.
But then I've found out that in order to add tables to database, your data context (class inherited from DataContext class) have to declare each table as a property! That's embarrassing. Does this fact mean that my idea is not implementable? Because I obviously cannot add properties to my DataContext-based in the runtime.
So my question is, am I right in my judgments? If yes, are there some workarounds to solve this issue?
Thanks in advance.
EDIT: better question tagging, for somebody finally notice this.
You do not need to use a strongly typed DataContext (a class inheriting from DataContext and declaring properties for each table). You can do something like the following instead
var context = new DataContext("connection string", new AttributeMappingSource());
var table = context.GetTable<T>();
where T is some type marked with the Table attribute.

How to update tables from a View using Linq to Entities

I have a View in an SQL Server Database, which involves many different tables. I am using Linq to Entities to access the database, so I have no problem getting and showing view's result.
But the problem is when I want to modify some field in those results. As long as a view doesn't have a primary key, the Entity is read-only, so the question is:
Is there any way to modify the object with the view's data and save those changes in the corresponding tables?
Sorry for my english, but it's not my native language.
Thank you very much in advance!
There are some requirements for VIEW to be updatable. Take a look here. You say your view references many tables, so you have to implement INSTEAD OF trigger.

XtraReport and xrTable shows only 1 record

I have a linq to sql generated object MyObject and this contains an EntitySet.
Now i use an XtraReport with a BindingSource.DataSource = MyObject. I have a xrTable in the Detail band (which is the only one i use btw) with four xrTableCells binded binded to properties from MyObject.MyotherObject.Property. It keeps showing me only the first record and not all of them.
Anyone with an idea?
I believe you'll need to implement the ITypedList with your custom object to use it as a datasource. Check out this online documentation article for more info:
http://www.devexpress.com/Help/?document=XtraReports/CustomDocument4046.htm
I have just solved a similar problem. Did you use typed datasets to help you layout the report at design time? If you did then clear the Data Source in design view. If you apply LINQ to SQL Data Source at runtime without clearing the typed dataset Data Source in the design view, you may get only one row showing in the detail band.
i have similar problem and tried above answers, but it was so simple
just set your report DataMember to the name of your sub collection MyObject.MyotherObject
and the table will load all items in your sub collection.
XtraReport report = new XtraReport(){DataSource = MyObject,DataMember="MyotherObject" };

table alias in linq edmx

I am trying to replicate something that would be simple with a stored procedure.
I have a set of tables like so:
acem__main
acem__child
beta__main
beta_child
xyz__main
xyz__child
In my edmx, I have the acem_main and acem_child linked via a primary/secondary key.
However depending on who logs in I would like to utilise the data of either acem, beta or xyz.
I cannot imagine how to fit this into linq - can anyone help please?
Create a method that returns an IEnumerable and take a user as arguments. In the method, create three Linq queries for acem, beta or xyz and return the result from the query that correspond to the given user.

Linq to Entities, EntityReferences and DataGridViews

I am trying to select certain fields from my entity to be used as the datasource for a datagridview, but I haven't been able to make it work. Is such a thing possible? For example, I have a Customers entity that contains several entityreferences. I want to take fields from the customers entity and from within those entityreferences and display them in the datagridview. I haven't been able to come up with a Linq query to accomplish this, and even when you simply use the entire entity as the datasource the fields within the entityreferences are not displayed. Any idea what I am doing wrong? Thanks for the help.
from customer in context.customers
select new
{
Name = customer.Name,
City = customer.Address.City
}
that will create a custom object and you can see the second property is referencing an entity field on the primary entity.. basically just transform the data to a new object and bind the enumerable generated to the grid.
sorry if this is a little mumbled, typing on my phone.
Caveat: This is not tested with entity framework references.
When using object data sources you can reference properties of object references, but you must first cast the object:
<asp:Label ID="lblCity" runat="server" Text='<%# ((Customer)Container.DataItem).Address.City%>'></asp:Label>
Could this be your problem accessing properties of the entity references?

Resources