Deleted CRUD Table Facade.class still being generated: how to remove? - jsf-2

I removed a table from my Derby database, re-generated the 'Entity classes from database' and regenerated the CRUD files in Netbeans 7.0.1 but it keeps generating a Facade.class file for the deleted table: 'SEARCH_CRITERIA_TBL'.
I have deleted everything I can find related to the CRUD and done a clean and rebuild but it insists on regenerating the file:
\NetBeansProjects\Server\build\web\WEB-INF\classes\JSFBeans\SearchCriteriaTblFacade.class
The project compiles but the server fails to start with the following error:
Blockquote
WARNING: Exception while starting bundle com.sun.enterprise.osgi-adapter [154]
org.osgi.framework.BundleException: Activator start error in bundle com.sun.enterprise.osgi-adapter [154].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1751)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915)
at org.jvnet.hk2.osgimain.Main.start(Main.java:140)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassFormatError: Absent Code attribute in method that
is not native or abstract in class file JSFBeans/SearchCriteriaTblFacade
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:920)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1430)
at com.sun.enterprise.deployment.annotation.impl.ModuleScanner.getElements(ModuleScanner.java:247)
at com.sun.enterprise.deployment.archivist.Archivist.processAnnotations(Archivist.java:541)
at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:433)
at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:420)
at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:396)
at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:373)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:238)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:247)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:208)
at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:148)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:162)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:79)
at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:612)
at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:554)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:262)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:362)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:185)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:236)
at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:128)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:457)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:401)
at org.jvnet.hk2.osgiadapter.HK2Main.start(HK2Main.java:125)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
... 9 more
Searches of the net only tell me what the 'JSF from Entity Classes' does not how it works internally. No doubt I am searching on the wrong terms...
Does anyone know where the Facade.classes create data is kept or can anyone tell me what terms I need to search on to find out? I have searched the entire project and found no reference to 'SearchCriteriaTbl' or 'SEARCH_CRITERIA_TBL'. I have manually deleted the SearchCriteriaTblFacade.class file, but it still reappears when the project is cleaned and rebuilt.
Kind thanks in advance.

Workaround: I re-inserted the deleted table into the database, regenerated the entity classes and CRUD files, and recompiled. Then removed the table again, re-created the entity classes from database and re-did CRUD creation. I then did a refactor delete rather than a normal delete of the unneeded files. After about three clean and recompiles it eventually sorted itself out and is now working.

Related

neo4jrb DeprecatedSchemaDefinitionError

I've a problem with Neo4jrb 8.1.1, Rails 5.1.1, Neo4j 3.2.0 CE
I have a City model with an Int id, the DB is read only with data imported from csv files.
What should I declare to get rid of the error?
So far, I thought that declaring
id_property :id
property :name
would be fine but it doesn't work.
Overall, I'm annoyed with these new migrations files because the Neo4J DB is already done, I'm not supposed to write or modify indexes or constraints.
What's the error message you're seeing? I imagine you can solve the issue by creating an initializer and manually adding the relevant constraint(s) to the ModelSchema. Something like Neo4j::ModelSchema.add_defined_constraint(City, :id). It's also possible that this could be done inside the Model itself. Some experimentation should solve the problem.
See the source code for more info:
https://github.com/neo4jrb/neo4j/blob/8.1.x/lib/neo4j/model_schema.rb
http://www.rubydoc.info/gems/neo4j/Neo4j/ModelSchema

MVC 4 Server error

I am new to mvc in asp.net, so I have started with movie application in mvc with code first approach. My problem is when I change or add new field in movie class, then I got an error like
The model backing the 'MovieDBContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).
So anyone knows the solution for it with code first approach after changing or add any new field ...
using three command its solve which are list below.....which we have to write in package manager console
1)Enable-Migrations -ContextTypeName MvcMovie.Models.MovieDBContext
2)add-migration Initial
3)update-database
but why this error occurs and is there any other solution for it without the above three commands in mvc 4?
You have changed the Code First models since applying them to your database, so you need to reupdate, to apply these changes. First you add a new migration. Do this by typying this into the package manager console:
add-migration migrationName
migrationName should be unique and descriptive of the changes. After running this command, you should have a migration file, which you can apply by running:
update-database
Given that the changes are valid, they should now be applied to your database.
You have to do this every time you make changes to your CF models.

The operation failed because an index or statistics with name already exists on table EF6.1

I used entityframework 6.0.2 and every thing work very nice,
but when i update entityframewrok to 6.1.1 application throw following exception :
The operation failed because an index or statistics with name already exists on table
After one hour i found solution
i used "Add-migration" when my Entity framework's version was 6.0.2 but migration structure is different in EF 6.1.1 ,
So , i delete migrations class and use "add migration" again.
every thing is ok now
Regards

doctrine:generate-migrations-diff does not generate any new migration

After some changes I've made today in my schema.yml, each of one followed by the diff, migrate, build commands, the diff operation stopped working.
The last successful migration was the 243rd.
Now, every new change I make, when I give the diff command, the result is always the same:
/usr/bin/php /.../symfony --color doctrine:generate-migrations-diff
>> doctrine generating migration diff
>> file+ /tmp/doctrine_schema_92228.yml
Done.
No new file is created in lib/migration/doctrine, so I cannot use the migrate command to commit the changes to the db.
I tried to clear the cache, clean model files, build all classes, and also reboot.
Any ideas?
This is the best way I have come across to make migrations and success everytime. Cost me a lot to guess but works perfectly and works with multiple databases. I can be wrong in some sentences so feel free to add or correct me in anything you see.
MIGRATIONS, the safest way :)
If you need to work Migrations for multiple databases apply these patches and clear symfony cache, they work perfectly:
doctrine_core.r7687
doctrine_manager.r7657
A. BACKUP PROJECT AND DATABASE:
Save Symfony project Files. (optional but safe way).
Save Database Table Schemas only.
Save Database Table Data only.
Save Database Table Schema with Data.
B. HOW TO MAKE CHANGES TO .yml FILES:
.yml files cannot contain strange symbols, like ñ, ´, ```... or non UTF characters..
Always shows spaces and tabs in Notepad++ or Sublime. There cannot be tabs!!
You CANT have two modules with the same name, even in different databases. Never set two modules with same name or you will have a lot of problems.
If you want to work with multiple databases, you must specify the connection attribute at the beginning of your schema.yml file:
connection: doctrine_master
Working with multiple databases, again you must set the binding connection for the module with the right connection:
Tbtest001:
connection: doctrine_master
tableName: tb_test001
Setting the right variable value and type in schema.yml:
Schema Files
Variables, models and types
Working with multiple databases, take care and modify only one schema.yml for only one database each time!
If you are adding a new table with relations to another table, its recommended to do it in two steps, two migrations. First only add the table and migrate. Then Add the relation and Migrate again. It is the saftest way.
You can have different schemas.yml in different places.
C. MIGRATING THE CHANGES:
Install this plugin, because it has fixes and improvements for checking changes:
idlDoctrineMigrationPlugin
Make a new table for each database for your project. Needed for the plugin to work:
name: migration_version , column: version (int (11)). (autoincrement=false).
In version column, set its value to the lastest migration version you have now. You must do this step for every database where you have the table migration_version:
UPDATE databasetest.migration_version SET databasetest.migration_version.version='31';
UPDATE databasetest2.migration_version SET databasetest2.migration_version.version='31';
Clear Symfony cache:
symfony cc
Make the migration difference (you need the plugin above and version tables created)
symfony model:diff > migratediff.log
Check if the lastest generated changes are right in the following files:
.\lib\migration\doctrine\XXXXXX_versionXXX.php
.\data\migration\history\XXXXXXXXXX.yml
Proceed with the migration UP by specifing a number!, NEVER make migrate UP!. Also take in mind the new parameter --connection. It works now if you applied the above patches and it will migrate only the right databases:
symfony doctrine:migrate 32 --connection=doctrine_master > migrateUP.log
Rebuild models, Forms, Filters, Delete old models..
symfony doctrine:build-model
symfony doctrine:build-forms
symfony doctrine:build-filters
symfony doctrine:clean-model-files
symfony cc
Set all databases to the lastest migration number in their table migration_version:
UPDATE databasetest.migration_version SET databasetest.migration_version.version='32';
UPDATE databasetest2.migration_version SET databasetest2.migration_version.version='32';
Optional step, if you want to know the lastest SQL query send to the database after the migration:
symfony doctrine:build-sql [--application[="..."]] [--env="..."]
D. LINKS AND FILES:
Correct way to do a migrations diff
Doctrine migrations fallback
http://trac.symfony-project.org/ticket/7272
http://trac.symfony-project.org/ticket/7689
http://trac.symfony-project.org/ticket/8604
http://php-opensource-help.blogspot.com/2010/07/how-to-get-connection-from-doctrine-to.html
http://www.doctrine-project.org/documentation/manual/1_1/en/connections
http://forum.symfony-project.org/viewtopic.php?t=29361&p=104098
Main Files involved in migrations:
Migration.php, Builder.php, sfTaskMigration.php

How to avoid loading my models in a rails Migration

I have a rails project that uses an old versions of the FlexImage plug-in to handle images.
In the old version that image data was stored in a column called "data", in the new version that column must be named "image_file_data".
I wrote a migration to rename the column, but when I try to run the migration, my guess is that rails tries to load the models, which then automatically check to see if the valid column is there (which it isn't) and that throws an error which halts the migration.
I would guess that my problems would be solved if I never loaded the model classes in question and just wrote some sql to rename the columns. But the following line doesn't work, since rails still tries to load the model.
Apartment.connection.execute "ALTER TABLE logos CHANGE DATA image_file_data MEDIUMBLOB;"
Oops, I figured it out. I was calling
model = (table_name.to_s).classify.constantize
Earlier, and this was causing the model to load

Resources