Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

JCRUtil.copy vs Workspace.copy - which one to use and when

chetan_vajre1
Level 2
Level 2

We are copying entire directory from one folder to other folder - we've two API's to do it. We can do it at workspace or using JCRUtil. Which one should we use and what are the use cases for each?

We do see this error sometimes when we do workspace.copy()  - unresolved conflicts (and fail during commit)

1 Accepted Solution
MC_Stuff
Correct answer by
Level 9
Level 9

Hi Chetan,

  • Functionality wise both are same & internal implementation have some changes. 
  • The main difference top of my head is  Workspace save don;t need transient storage and saves automatically. Where as JCRUtil need explicit session save. 
  • Any issue with copying will throw an exception. 
  • For your use case workspace copy looks good to me.

Thanks,

View solution in original post

1 Reply
MC_Stuff
Correct answer by
Level 9
Level 9

Hi Chetan,

  • Functionality wise both are same & internal implementation have some changes. 
  • The main difference top of my head is  Workspace save don;t need transient storage and saves automatically. Where as JCRUtil need explicit session save. 
  • Any issue with copying will throw an exception. 
  • For your use case workspace copy looks good to me.

Thanks,

View solution in original post