reset password
Author Message
zhasan76
Posts: 17
Posted 14:44 Oct 30, 2010 |

How can I get ParentId against a file id using hibernate .

Thanks

cysun
Posts: 2935
Posted 15:13 Oct 30, 2010 |

You shouldn't need to get parent id using Hibernate. Once you have a File object, you can do file.getParent().getId().

mkhalil
Posts: 8
Posted 12:41 Nov 04, 2010 |

I'm not able to get   "file.getParent().getId()", its give me NullPointerException ?

2010-11-04 12:39:23,436  INFO BusinessObjectAccessVoter: Grant s0001 access to csns.model.File::2000005
2010-11-04 12:39:23,440 ERROR ExceptionResolver: Exception caused by user s0001
2010-11-04 12:39:23,440 ERROR ExceptionResolver:
2010-11-04 12:39:23,440 ERROR ExceptionResolver: java.lang.NullPointerException
 at csns.spring.controller.files.FilesManagerController.handleRequestInternal(FilesManagerController.java:58)
 at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
 at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
 

Any hint!!

Thanks

kknaur
Posts: 540
Posted 16:08 Nov 04, 2010 |

Hint: The parent of a File will be null if you are currently looking at the root folder, or if you are in a folder whose parent is the root folder

Last edited by kknaur at 16:40 Nov 04, 2010.