StrataFrame Forum

How configure businessobject to use view?

http://forum.strataframe.net/Topic25533.aspx

By dgsoft - 1/13/2010

Hi,

I have some view and want to use business object to provide access to this view (bind to grid, use as datasource and so on)

So,

I create view using DDT, then deploy it

Then I create new business object, start Business object mapper

Select business object

Click "Configure"

Then using "DDT" option in optiongroup - click "Select" - and there only tables are listed.



The question is:

How can I create business object based on view?



Thanks

Denis
By Les Pinter - 1/13/2010

Hi Denis,

   If your view is located in a SQL Server database, use SQL Server instead of the DDT option, and you should see your view in the list of "tables" under your database node.

Les

By Trent L. Taylor - 1/13/2010

Les is right on the money. When you want to pull a schema of a view for a BO, point it to SQL Server and select the view instead of the DDT. SQL Server will then do all of the parsing to give you all of the fields that are available. If you plan on doing updates on this BO, you will want to make sure that you use a BO Mapper override to supply the BO with a default primary key and be sure to make the view bindable to the schema (this is a check box in the DDT on the view).
By dgsoft - 1/13/2010

Les, Trent,

Thanks for help!



Denis
By Charles R Hankey - 1/14/2010

If you have all your business objects in their own assembly ( the way it is done in Strataflix) you will also find you will want a different assembly for business objects that are based on views.



I found that all the business objects in an assembly need to either use DDT or SQL directly, but you can't mix them, since you configure the whole project in the BO mapper to use either DDT or SQL directly.


By Edhy Rijo - 1/14/2010

Charles R Hankey (01/14/2010)
I found that all the business objects in an assembly need to either use DDT or SQL directly, but you can't mix them, since you configure the whole project in the BO mapper to use either DDT or SQL directly.


Hi Charles,



I am sorry, but you are wrong in that statement. Cool



Each BO can be setup to use any source to get the table schema, just select any BO and right click and choose "Properties" and there you can select any source supported, the same thing can be done at the BO Project level, but this is basically done to get the connection string and sort of the default source, but as you can see each BO can have different Source to read the schema.
By Trent L. Taylor - 1/14/2010

I found that all the business objects in an assembly need to either use DDT or SQL directly, but you can't mix them, since you configure the whole project in the BO mapper to use either DDT or SQL directly.




Charles, thanks for your comments. But I do want to point out that you can in fact have every BO in the entire project pull from an entirely different location. The project settings are defaults only. On each BO when mapped, you can elect to use the DDT, SQL, OLEDB, etc. You can even override the SQL Connection on a per BO basis to pull a schema from an entirely different server if you like.
By Charles R Hankey - 1/14/2010

Ok, I have to go back and look at this again. Greg and I hammered on this an came to the conclusion we needed a separate project for the views BOs but it was early in my SF career and I haven't looked at ti closely since.



I don't doubt you're right but somehow we both missed how to do it. Glad be wrong about this one as I found it very non-intuitive and inconvenient and that is not a common feeling in learning strataframe. Smile
By Charles R Hankey - 1/14/2010

I just figured out why we thought it wouldn't work. Originally set it up to use DDT then when we tried to configure an individual BO and selected sQl it complained there was no connection string. Obvious now that going back to the project level, temporarily changing to sql then setting the connection string and then setting it back to DDT lets you have DDT as the default and then configure some the views BOs to use the SQL view directly.



Sorry for the stupid advice but at least I learned something from it. ( it is my learning style - get smart by saying dumb things Cool )


By Trent L. Taylor - 1/15/2010

LOL...nothing to worry about. Glad you got it figured out Smile
By Ross L. Rooker, Sr. - 2/17/2010

We have our BOs set up to point to the DT at the project level and also at the individual BO level. We have about 200 BOs. The types of the columns in SQL are all set to be 100 percent with the way Strataframe generates column types in Oracle. We also made sure that all our code was 100 percent compatible with Oracle.

I want to merely copy all tghe SQL project BOs over the existing Oracle BOs since we have made many changes and want a parallel Oracle BO Project.

My question here is on the Oracle Project after I copy the BO Project files from the SQL Server based BO Project over the Oracle BO project files using the same BO Mapper project:

1. Is there an easy way to just change to default at the project level to Oracle DB with the connect and then in a global step to change the default for each individual BO to point to the Oracle DB?

The tables names are identical. So I would not want to have to go in on each BO and configure it to select the table. No need to since the table and column names are indentical. If I could do this globally then all I would need to do would be to Generate the designer code for all 200 BOs for the entire Oracle Project, then set the global setting back to the DT and all of BOs back to the DT.

We only have a single BO Mapper and did not want to create a second one because setting the defaults in the mapper takes a long time and we realized the wizard to set the defaults still has a bug in it so that must be done 1 column at a time.

I know that this may not be the perfect way to go about handling both SQL Server and Oracle but this is the way we are doing it. If I have to go in each time and configure them separately it takes time.

If the answer to question 1 is to access the Strataframe configuration DB, what tables and columns would I need to change? 

By Trent L. Taylor - 2/17/2010

I want to make sure that I understand what you are doing. First, you are going to have two totally different sets of BOs, right? One for SQL Server and another for Oracle?



CustomerSqlBO



CustomerOracleBO




Are you doing this because the data type issues? Also, what are your plans for the forms, etc?



I don't need a huge explanation, I just want to be clear on what you are trying to accomplish.