openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: entity update
Date Mon, 08 Feb 2010 17:22:53 GMT
Have you looked at the EntityManager interface [1]?

[1]
http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.html#remove%28java.lang.Object%29

-- 
Thanks,
Rick

On Mon, Feb 8, 2010 at 7:39 AM, mlounnaci <mlounnaci@hb-technologies.dz>wrote:

>
>
> Hello friends
>
> I have an entity called workflow and another one called process.
> The workflow has a collection of processes, it means a oneToMany relation,
> and the process itself has a reference to workflow.
> @Entity
> public class Workflow implements Serializable{
>        private static final long serialVersionUID = -6940501155081900165L;
>        @Id
>        @GeneratedValue(strategy=GenerationType.IDENTITY)
>        protected int id;
>        @Column(name = "NAME")
>        protected String name;
>
>        @OneToMany(mappedBy="workflow",cascade = {CascadeType.PERSIST,
> CascadeType.MERGE, CascadeType.REMOVE}, fetch=FetchType.EAGER)
>        protected List<Process> processes;
>        public List<Process> getProcesses() {
>                return processes;
>        }
>
>        public void setProcesses(List<Process> processes) {
>                this.processes = processes;
>        }
>
> }
>
> @Entity
> public class Process implements Serializable{
>
>        @ManyToOne(cascade = CascadeType.ALL)
>        Workflow workflow;
>
>        Other fields.........
> }
>
>
> The problem is how can I delete a process from a workflow assuming that the
> workflow entity was already persisted in database.
>
> Thanks in advence.
> mlounnaci
> --
> View this message in context:
> http://n2.nabble.com/entity-update-tp4534156p4534156.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message