View imported as table

Hi,
I’m trying to import a solution to a servoy repository. The database asociated has a view.
Everything goes ok, no errors displayed, just the warning that the view couldn’t be created or updated so I would have to do it myself.
If I check the database there is no view, insted servoy has created a table reflecting the view fields. :?
So now everytime I import the solution to a client or server I need to change the database to create the view and drop the table.
Is there a way to solve this problem??
If there isn’t, are servoy guys trying to solve this???

Thanks for the replies. :D

when you import a solution you also have the option to turn data model changes off:
"Allow data model (database) changes "

then it shouldnt touch your db.

if you have other table changes than you are in trouble!

We have bumped into this many times, and filed a case back in 2009: case: 195448

answer:
closed-not applicable

      • V Feb 27, 2009 12:13 / Mail sent - - - - - - - - - - - - - -
        Check your import log and delete created table. We need to create a table to have consistency during import.

You need to make sure the view exists before Servoy imports the Solution, otherwise Servoy will automatically create the a table, as it’s not possible for Servoy to create Views in the database, because Views are based on SQL and the SQL is database vendor specific to start with and secondly, JDBC, the protocoll Servoy used to talk to the database does not allow to retrieve the underlying SQL of a view.

So, you can do the view creation manually before import, or utilize the pre import hook introduced in Servoy 5.0. In this hook you can do whatever you want to the database (create the entire datamodel manually, create views, indexes, migrate data from one table to the other etc. etc.). After the pre import hook Servoy will import the solution and create any still missing table and/or column in the database.

There’s also a post import hook to do more stuff after importing. Have a look here for more info on the hooks: http://wiki.servoy.com/display/DOCS/maintenance

Paul

pbakker:
You need to make sure the view exists before Servoy imports the Solution

Paul, is Servoy aware of newly created views outside Servoy without restarting the application server?
What I know is that Servoy isn’t aware of newly created columns outside Servoy. So in case you go ahead and import your solution without an application restart your in trouble…

@nromeaou: you can take a look at the docs of the vendors DB to see if there are SQL commands to create views.
if so, it might be useful to create a table which holds records with all details of your views.
A small ‘admin solution’ can create the views for you by just looping through those records and execute a command via the rawSQL plugin…

This is how we manage our index.
Downside (as Paul already mentioned) is: the SQL is vendor specific, so your bound to a certain vendors DB (unless you look up the SQL for multiple vendors and generate the code as well… ;-) )

Have a look at the documentation I pointed to: you can tell the Servoy Application Server to reload all the information it holds in memory about the database, so when you create new objects in the database outside Servoy, you can have Servoy see them without restarting the Application Server.

Paul