You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Gabriel Oberreuter <go...@gmail.com> on 2016/01/20 16:47:28 UTC
get all fields of an Entity
Hi all,
Do anyone knows how to get all fields of a given Entity programmatically? I
can't seem to find that functionality of just lack the java knowledge to
just do it.
I am creating a query and want to select "all" current fields of an entity.
When executing the query, I can pass a Set of fields to select. I need
something of the like:
Set<String> fieldsOfEntityInvoice = Invoice.getAllEntityFields();
For now, I am building the Set manually, adding each field of the entities
using set.add("invoiceId"), for example.
Thanks
--
View this message in context: http://ofbiz.135035.n4.nabble.com/get-all-fields-of-an-Entity-tp4676259.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: get all fields of an Entity
Posted by Jeremy Olmstead <jo...@gmail.com>.
Something like this should work:
ModelEntity modelEntity = delegator.getModelEntity("Invoice");
List<String> fieldNames = modelEntity.getAllFieldNames();
On Wed, Jan 20, 2016 at 10:37 AM, Gabriel Oberreuter <go...@gmail.com>
wrote:
> Jeremy Olmstead wrote
> > If you pass null as your set of fields, it will select all fields.
> >
> > Jeremy
>
> Oh, thanks. That works great to select all fields when executing the query.
>
> I still need to get all fields of an entity at other parts of our code, do
> you know how to achieve this?
>
>
>
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/get-all-fields-of-an-Entity-tp4676259p4676262.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
Re: get all fields of an Entity
Posted by Gabriel Oberreuter <go...@gmail.com>.
Jeremy Olmstead wrote
> If you pass null as your set of fields, it will select all fields.
>
> Jeremy
Oh, thanks. That works great to select all fields when executing the query.
I still need to get all fields of an entity at other parts of our code, do
you know how to achieve this?
--
View this message in context: http://ofbiz.135035.n4.nabble.com/get-all-fields-of-an-Entity-tp4676259p4676262.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: get all fields of an Entity
Posted by Jeremy Olmstead <jo...@gmail.com>.
If you pass null as your set of fields, it will select all fields.
Jeremy
On Wed, Jan 20, 2016 at 9:47 AM, Gabriel Oberreuter <go...@gmail.com>
wrote:
> Hi all,
>
> Do anyone knows how to get all fields of a given Entity programmatically? I
> can't seem to find that functionality of just lack the java knowledge to
> just do it.
>
> I am creating a query and want to select "all" current fields of an entity.
> When executing the query, I can pass a Set of fields to select. I need
> something of the like:
>
> Set<String> fieldsOfEntityInvoice = Invoice.getAllEntityFields();
>
> For now, I am building the Set manually, adding each field of the entities
> using set.add("invoiceId"), for example.
>
> Thanks
>
>
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/get-all-fields-of-an-Entity-tp4676259.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>