On Thu, Mar 12, 2020 at 04:45:31PM -0400, Jose Blanco wrote: > 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; > > }
I think that you are correct. xxxService.create() instantiates the entity. You set values for its fields. Then xxxService.update() saves the instance. This is all just doing things in Hibernate's cache, which keeps some entity instances handy and keeps track of whether they have been altered. Behind the scenes, Hibernate's cache manager fills these instances from database rows and uses mutated values to update database rows. But often you can think of it as: .create() INSERTs an empty row, .find() SELECTs a row, and .update UPDATEs a row. -- 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 dspace-tech+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/20200318185444.GD3874%40IUPUI.Edu.
signature.asc
Description: PGP signature