legacy-database

NHibernate navigators mapped to the part of a composite key problem - legacy database usage

僤鯓⒐⒋嵵緔 提交于 2019-12-10 14:13:55
问题 We have a legacy database that we cannot change. And we are trying to move to the NHibernate instead of old DataAccess layer which is a garbage and is too slow. it has tables like these: GPI table has (PU_ID, PAR_ID, Data, Data2) columns BLOCK table has (GA_ID, Data, PAR_ID) columns COMPANY table has (PU_ID, Data) columns I had created these mappings for the tables above: GPI <class name="GroupPartnerInterest" table="[GPI]"> <composite-id > <key-property name="GroupId" column="PAR_ID" /> <key

Combine two unrelated tables/models with same primary key in Django

亡梦爱人 提交于 2019-12-10 13:39:07
问题 I have two unrelated tables with the same primary key. ip mac 11.11.11.11 48-C0-09-1F-9B-54 33.33.33.33 4E-10-A3-BC-B8-9D 44.44.44.44 CD-00-60-08-56-2A 55.55.55.55 23-CE-D3-B1-39-A6 ip type owner 22.22.22.22 laptop John Doe 33.33.33.33 server XYZ Department 44.44.44.44 VM Mary Smith 66.66.66.66 printer ZWV Department The first table is automatically refreshed every minute. I can't change the database structure or the script that populates it. Both tables have ip as PRIMARY KEY. In a view, I

How to gracefully handle “Mysql2::Error: Invalid date” in ActiveRecord?

本秂侑毒 提交于 2019-12-09 21:55:04
问题 I'm building a Rails 3.2 app upon a legacy database which also has some broken records in different tables. One of the issues giving the most headache is that it includes invalid dates. I've setup a sandbox which I manually fixed one time to get my code working. Now it's time for deployment. For this reason, the sandbox is reset every night and copied from the live database, ferret indexes are rebuilt, and migrations are re-applied. We are going to deploy to the sandbox often to get in the

How do I work with a LEGACY database in Rails?

北城余情 提交于 2019-12-08 04:17:40
问题 I'm working on a Rails web site that profiles stock mutual funds and ETFs. I ALREADY HAVE a separate Ruby script that runs nightly and populates a Postgres database with data on these mutual funds and ETFs. Chapter 6 of Rails tutorial isn't quite what I'm looking for. The differences between what I'm trying to do and what chapter 6 of Rails tutorial does are: 1. In my Rails site, there is no need to create a database, because it has already been populated. So I don't think I need to use

What ORM would you choose for working with legacy databases?

坚强是说给别人听的谎言 提交于 2019-12-08 00:36:58
问题 I am in the process of integrating a number of legacy systems. They each have different databases; and I will need to write data access code for most of them. The database schemas cannot be changed (I might be able to apply some indexes and such, but tables and their columns must retain the structure). Some of the databases has an OK design, with appropiate relationsships and primary / foreign keys, and some of the other databases lacks that very much. Which ORM would you choose for this task

Django automatically create primary keys for existing database tables

时间秒杀一切 提交于 2019-12-07 09:00:52
问题 I have an existing database that I'm trying to access with Django. I used python manage.py inspectdb to create the models for the database. Currently I'm able to import the models into the python shell however when I try to access any of the actual objects in any way, I get this error OperationalError: (1054, "Unknown column 'some_table.id' in 'field list'") . I see that the table in the database in fact does not have an id field. How can I fix this? Do I need to update the managed field in

JPA OneToOne association where 2 entities use composite primary keys but use different column names?

那年仲夏 提交于 2019-12-06 06:13:25
We are trying to use Hibernate with a database that uses a lot of composite keys and it's been causing us a lot of headaches. Unfortunately, we can't change the schema so we have to do a lot of additional mapping betwen our fields. We are restricted to using JPA 1.0 and Hibernate 3.3. The biggest problem we've had so far is to do with a one-to-one association between two entities using a composite key of 2 values, where the tables have different names for these columns (the DB has a naming convention of having a table-specific prefix on each column.) Whenever we perform our query, we get this

How to gracefully handle “Mysql2::Error: Invalid date” in ActiveRecord?

﹥>﹥吖頭↗ 提交于 2019-12-04 17:30:01
I'm building a Rails 3.2 app upon a legacy database which also has some broken records in different tables. One of the issues giving the most headache is that it includes invalid dates. I've setup a sandbox which I manually fixed one time to get my code working. Now it's time for deployment. For this reason, the sandbox is reset every night and copied from the live database, ferret indexes are rebuilt, and migrations are re-applied. We are going to deploy to the sandbox often to get in the last fixes before deploying to the live setup. As the legacy PHP app and this new Rails app need to run

Setting up Liquibase with MS-SQL Server

孤街醉人 提交于 2019-12-04 09:24:22
问题 I am utilising Liquibase (www.liquibase.org) into our MVC3 SQL Server 2008 project to manage database migration/changes. However I'm stumbling on the first hurdle: Connecting to Microsoft SQL Server instance. I am looking at the quick start tutorial on the liquibase site, but exchanging the mysql for sql server DB I run this command: liquibase --driver=sqljdbc.jar --changeLogFile="C:\Temp\ChangeLog.xml" --url="jdbc:sqlserver://localhost;databaseName=test" --username=user --password=pass

Hibernate chokes on missing rows when dealing with a legacy database

孤街醉人 提交于 2019-12-03 23:54:23
I am trying to implement hibernate on a legacy database (that still has a legacy PHP client), and am running into some problems because the people who wrote the original app had no idea what they were doing. The database is set up so that none of the columns are nullable, so they default foreign keys to 0 if there is no record for them. Additionally, they don't have proper foreign keys on the tables so there are a few with invalid IDs. I do not have an option to change the schema or null the appropriate columns. This is the error I get from hibernate: Caused by: org.hibernate