OneBusAway / onebusaway-gtfs-modules

A Java-based library for reading, writing, and transforming public transit data in the GTFS format, including database support.

Home Page:https://github.com/OneBusAway/onebusaway-gtfs-modules/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update a currently stored feed

jheld opened this issue · comments

Is there a tool in this family of projects that allows me to pull in an updated feed, but not explicitly using the merge utility? The example here that I have is: a-0.zip has been processed and saved out for some time, and a-1.zip gets imported...and is the same sort of agency, but may have updated routes, or stops or times, etc.

I can use the merge utility, but that's going to force me to flush out my database -- which is an expensive operation, and really seems brute force.

You could use hibernate. For each object (agency, route, shape...), update it within database.

In my experience, using hibernate on rows with identical primary keys would result in exceptions and the program terminates. Is there a way around that, using the hibernate-cli?

@jheld there is a method called HibernateGtfsRelationalDaoImpl.saveOrUpdateEntity(Object entity) which updates an entity in case of previous existence or else creates a new one, in an smart manner. Otherwise, I can't see your point here...

Ah, no this makes sense. You're right. I'm using the hibernate-CLI with the precompiled jar, which is why I didn't see this option. Unfortunately, I don't see my project switching out/adjusting the CLI to use that function, but thank you for letting me know.

You're welcome @jheld. I'm almost new to OneBusAway and I'm learning how to use this helpful family of tools. A good way to see how Hibernate CLI works is to clone the repo using your preferred IDE (I'm using Eclipse Mars), create a database and configure it, add to your pom.xml the JDBC dependency of your database, creating a Run/Debug configuration with the needed arguments and running the Main class. That's what I've done.