# Query on persistante device settings

**URL:** <https://forum.inductiveautomation.com/t/query-on-persistante-device-settings/11011>\
**Category:** 3rd Party Modules\
**Created:** [January 8, 2016, 9:50am UTC](https://forum.inductiveautomation.com/t/query-on-persistante-device-settings/11011 "2016-01-08T09:50:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thierry38](https://avatars.discourse-cdn.com/v4/letter/t/919ad9/32.png) [@thierry38](https://forum.inductiveautomation.com/u/thierry38)\
**Post date:** [January 8, 2016, 9:50am UTC](https://forum.inductiveautomation.com/t/query-on-persistante-device-settings/11011/1 "2016-01-08T09:50:00Z")

</div>

Hi,

We’ve created a module which manages devices. These devices can be manually added by user in Ignition but there is also an automatic device discovery function (using UPnp).

When a device is automatically discovered, we need to check if this device wasn’t previously configured by the user (check the address meta data of each configured device).

I’m looking for Ingnition PersistenceInterface class and I found two interesting methods .

- find(RecordMeta meta, java.lang.Object… primaryKeys)  
what is or are the primary keys ? How can the be configured ? How can they be specified in this query ?

- queryOne(simpleorm.dataset.SQuery query)  
How can the query be specified ? Is there any documentation or example ?

Thanks for your help 😲

---

<div class="post-metadata">

**Author:** ![thierry38](https://avatars.discourse-cdn.com/v4/letter/t/919ad9/32.png) [@thierry38](https://forum.inductiveautomation.com/u/thierry38)\
**Post date:** [January 8, 2016, 3:43pm UTC](https://forum.inductiveautomation.com/t/query-on-persistante-device-settings/11011/2 "2016-01-08T15:43:50Z")

</div>

For information, I found how to create a query in the online Ignition documentation at this address [https://docs.inductiveautomation.com/display/SE/Storing+data+with+PersistentRecords](https://docs.inductiveautomation.com/display/SE/Storing+data+with+PersistentRecords). (see “chapter Querying Records”)

Basically, if your driver setting class is called “EcoSpecDriverSettings” and if this setting class has an “ADDRESS” field, you can create a query to check for a field which contains a specific address with the following instructions :

```auto
PersistenceInterface persistenceInterface = getContext().getPersistenceInterface();
PersistenceSession session = persistenceInterface.getSession();

SQuery<EcoSpecDriverSettings> query = new SQuery<EcoSpecDriverSettings>(EcoSpecDriverSettings.META).eq(EcoSpecDriverSettings.ADDRESS,aIPAddress) ;

EcoSpecDriverSettings result = session.queryOne(query);
```

I hope this will also be usefull for somebody 😃
