I think I see an example:

    @Override

    public ResourcePolicy createResourcePolicy(Context context,
DSpaceObject dso, Group group, EPerson eperson, int type, String rpType)
throws SQLException, AuthorizeException {

        if(group == null && eperson == null)

        {

            throw new IllegalArgumentException("We need at least an eperson
or a group in order to create a resource policy.");

        }


        ResourcePolicy myPolicy = resourcePolicyService.create(context);

        myPolicy.setdSpaceObject(dso);

        myPolicy.setAction(type);

        myPolicy.setGroup(group);

        myPolicy.setEPerson(eperson);

        myPolicy.setRpType(rpType);

        resourcePolicyService.update(context, myPolicy);


        return myPolicy;

    }

On Thu, Mar 12, 2020 at 4:39 PM Jose Blanco <[email protected]> wrote:

> Mark, I have one question.  Can you point me to and example of how a row
> is inserted into a table.
>
> Thanks!  Jose
>
> On Wed, Feb 26, 2020 at 9:15 AM Mark H. Wood <[email protected]> wrote:
>
>> On Tue, Feb 25, 2020 at 02:22:01PM -0500, Jose Blanco wrote:
>> > I just tried:
>> >
>> >        Query q = getHibernateSession(context).createSQLQuery("SELECT *
>> FROM
>> > EPerson  WHERE uuid in (SELECT proxy_id from proxies where depositor_id
>> = '"
>> > + depositor_id.toString() + "')");
>> >
>> >        q.setResultTransformer(Transformers.aliasToBean(EPerson.class));
>> >
>> >        List<EPerson> results = q.list();
>> >
>> >        return results;
>> >
>> >
>> >
>> > And I'm getting:
>> >
>> >
>> > org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111
>> >
>> >
>> > in this line:
>> >
>> >        List<EPerson> results = q.list();
>>
>> I haven't dealt with this myself, but the first thing I would check is
>> whether Hibernate understands that proxies.proxy_id is of type UUID.
>>
>> I would guess that you'll continue to fight issues like this so long
>> as "proxies" is not associated with an ORM entity type.  That would
>> mean writing an entity class 'Proxies' to tell Hibernate all about
>> your table.  You can find examples in
>> 'dspace-api/src/main/java/org/dspace/content'.  To fit in with the
>> patterns of DSpace's object-relational mapping, you probably should
>> also write:
>>
>>   ProxiesDAO
>>   ProxiesDAOImpl
>>   ProxiesService
>>   ProxiesServiceImpl
>>
>> You'll also need to add a <mapping/> element to
>> dspace/config/hibernate.cfg.xml so that Hibernate knows that it should
>> expect to find your entity class.
>>
>> Yes, I know:  it looks like more frosting than cake.  But, if you use
>> Hibernate, then Hibernate needs a lot of information about what it is
>> to manipulate for you.  And, it will be easier to use other types as
>> examples if you follow the complete pattern.
>>
>> --
>> Mark H. Wood
>> Lead Technology Analyst
>>
>> University Library
>> Indiana University - Purdue University Indianapolis
>> 755 W. Michigan Street
>> Indianapolis, IN 46202
>> 317-274-0749
>> www.ulib.iupui.edu
>>
>> --
>> All messages to this mailing list should adhere to the DuraSpace Code of
>> Conduct: https://duraspace.org/about/policies/code-of-conduct/
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "DSpace Technical Support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/dspace-tech/20200226141439.GB8836%40IUPUI.Edu
>> .
>>
>

-- 
All messages to this mailing list should adhere to the DuraSpace Code of 
Conduct: https://duraspace.org/about/policies/code-of-conduct/
--- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/CAK%3DKc-sOqGXWE-9GDuX0HeVh42BeCCqCaghwOMBu533RXSd7DA%40mail.gmail.com.

Reply via email to