p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Enterprise Android: Programming Android Database Applications for the Enterprise (http://p2p.wrox.com/forumdisplay.php?f=751)
-   -   springSyncServiceContacts (http://p2p.wrox.com/showthread.php?t=93950)

tgkell December 29th, 2014 06:51 PM

springSyncServiceContacts
 
I'm trying to deploy the springSyncServiceContacts code, and the ant builddb step claims to succeed, but the SQL statements actually fail to execute.

I've traced this to two problems listed below. I believe I downloaded the code from this site, but it seems this code could never have worked, so I'll try getting a version directly from the git repository. In the meantime, if anyone has actually run this REST service, I'd be interested in knowing what exact code you used.

Problem 1:
The file src/com/enterpriseandroid/springServiceContacts/dataModel/Contact.java
has a @GeneratedValue annotation on a String data type:
Code:

        @Id
        @GeneratedValue(strategy=GenerationType.AUTO)
        private String id;

This problem causes Hibernate to generate invalid SQL DDL.

Problem 2:
The file contact.jdbc.sql creates a table called contact_sync but then attempts to create two indexes on a non-existent contact table:

Code:

CREATE TABLE contact_sync
(
id varchar(50) NOT NULL,
firstName varchar(255) NOT NULL,
lastName varchar(255) NOT NULL,
phone varchar(255),
email varchar(255),
deleted boolean,
updateTime bigint(20) NOT NULL,
version bigint(20) NOT NULL,
PRIMARY KEY (id)
);

create index updateTimeIndex on contact (updateTime);
create index firstNameIndex on contact (firstName);

The first problem seems nontrivial to fix, but the second one may be trivial. If I push through and get this REST service running, I'll post my patches.

tgkell December 30th, 2014 03:01 AM

I have the service running. It turns out the two problems do not stop the service from working.

Problem 1 is irrelevant because the Hibernate schema is not used, but fix it by deleting the @GeneratedValue line.

Problem 2 is fixed in the trivial way: simply rename the table on which the indexes are being created to contact_sync instead of the non-existent contact.


All times are GMT -4. The time now is 01:03 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.