[GeoNetwork-devel] JPA database model question

Hi

I’m updating in the develop branch the User domain class to track the last login date of users and implementing a Spring ApplicationListener to update the database with this information when a successful login occurs.

I wanted to add the new field to the table creation, but I see that web/src/main/webapp/WEB-INF/classes/setup/sql contains only the data sqls. But can’t find the DDL sql files (checked also in domain project). The tables are now created directly from the model classes?

Regards,
Jose García


GeoCat Bridge for ArcGIS allows instant publishing of data and metadata on GeoServer and GeoNetwork. Visit http://geocat.net for details.


Jose García
GeoCat bv
Veenderweg 13
6721 WD Bennekom
The Netherlands
http://GeoCat.net

Hi, There are no DDL files. Hibernate will both create the tables and add new columns. So you don’t need to migrate table definitions just data.

Jesse

···

On Tue, Mar 18, 2014 at 1:48 PM, Jose Garcia <jose.garcia@anonymised.com> wrote:

Hi

I’m updating in the develop branch the User domain class to track the last login date of users and implementing a Spring ApplicationListener to update the database with this information when a successful login occurs.

I wanted to add the new field to the table creation, but I see that web/src/main/webapp/WEB-INF/classes/setup/sql contains only the data sqls. But can’t find the DDL sql files (checked also in domain project). The tables are now created directly from the model classes?

Regards,
Jose García


GeoCat Bridge for ArcGIS allows instant publishing of data and metadata on GeoServer and GeoNetwork. Visit http://geocat.net for details.


Jose García
GeoCat bv
Veenderweg 13
6721 WD Bennekom
The Netherlands
http://GeoCat.net


Learn Graph Databases - Download FREE O’Reilly Book
“Graph Databases” is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech


GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

Hi Jesse

Thanks for the feedback, I tried and looks fine.

One more question about the model classes. From the User class is not possible to retrieve the groups of that user, I guess that is to avoid performance issues?

I want to retrieve all the users that are in a set of groups, but also filter by other User properties. From the actual code looks better to define a UserGroupSpec to manage such a filter?

Regards,
Jose García

···

On Tue, Mar 18, 2014 at 1:59 PM, Jesse Eichar <jesse.eichar@anonymised.com> wrote:

Hi, There are no DDL files. Hibernate will both create the tables and add new columns. So you don’t need to migrate table definitions just data.

Jesse


GeoCat Bridge for ArcGIS allows instant publishing of data and metadata on GeoServer and GeoNetwork. Visit http://geocat.net for details.


Jose García
GeoCat bv
Veenderweg 13
6721 WD Bennekom
The Netherlands
http://GeoCat.net

On Tue, Mar 18, 2014 at 1:48 PM, Jose Garcia <jose.garcia@anonymised.com> wrote:

Hi

I’m updating in the develop branch the User domain class to track the last login date of users and implementing a Spring ApplicationListener to update the database with this information when a successful login occurs.

I wanted to add the new field to the table creation, but I see that web/src/main/webapp/WEB-INF/classes/setup/sql contains only the data sqls. But can’t find the DDL sql files (checked also in domain project). The tables are now created directly from the model classes?

Regards,
Jose García


GeoCat Bridge for ArcGIS allows instant publishing of data and metadata on GeoServer and GeoNetwork. Visit http://geocat.net for details.


Jose García
GeoCat bv
Veenderweg 13
6721 WD Bennekom
The Netherlands
http://GeoCat.net


Learn Graph Databases - Download FREE O’Reilly Book
“Graph Databases” is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech


GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

On Tue, Mar 18, 2014 at 3:01 PM, Jose Garcia <jose.garcia@anonymised.com> wrote:

Hi Jesse

Thanks for the feedback, I tried and looks fine.

One more question about the model classes. From the User class is not
possible to retrieve the groups of that user, I guess that is to avoid
performance issues?

There were a few reasons really.

1. I was learning JPA and I wanted to keep things simple as I could
2. It is not hard to create a method in UserGroupRepository Custom or a
Spec that can do this query

I want to retrieve all the users that are in a set of groups, but also
filter by other User properties. From the actual code looks better to
define a UserGroupSpec to manage such a filter?

You can also create a method on GroupRepositoryCustom. Something like
findAllByUserId(int userId). Specs are more flexible because you can
and/or/not them together.

Jesse

On Tue, Mar 18, 2014 at 1:59 PM, Jesse Eichar <jesse.eichar@anonymised.com
> wrote:

Hi, There are no DDL files. Hibernate will both create the tables and
add new columns. So you don't need to migrate table definitions just data.

Jesse

On Tue, Mar 18, 2014 at 1:48 PM, Jose Garcia <jose.garcia@anonymised.com>wrote:

Hi

I'm updating in the develop branch the User domain class to track the
last login date of users and implementing a Spring ApplicationListener to
update the database with this information when a successful login occurs.

I wanted to add the new field to the table creation, but I see that web/src/main/webapp/WEB-INF/classes/setup/sql
contains only the data sqls. But can't find the DDL sql files (checked
also in domain project). The tables are now created directly from the model
classes?

Regards,
Jose García

--

* GeoCat Bridge for ArcGIS allows instant publishing of data and
metadata on GeoServer and GeoNetwork. Visit http://geocat.net
<http://geocat.net/&gt; for details. _________________________Jose
GarcíaGeoCat bvVeenderweg 13 6721 WD BennekomThe
Netherlandshttp://GeoCat.net/> *

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork

--

* GeoCat Bridge for ArcGIS allows instant publishing of data and metadata
on GeoServer and GeoNetwork. Visit http://geocat.net
<http://geocat.net/&gt; for details. _________________________Jose
GarcíaGeoCat bvVeenderweg 13 6721 WD BennekomThe
Netherlandshttp://GeoCat.net/> *