简体   繁体   中英

unchecked cast warning on Collection

I am mapping a postgres array_agg value to a list, but I'm getting a warning below Unchecked cast: 'java.lang.Object' to 'java.util.Collection<java.lang.String> What is the fix for this?

public UserDTO transformTuple(Object[] objects, String[] strings) {
    List<String> roleList = new ArrayList<>((Collection<String>)objects[7]);

You need to create Custom Types so that your java application can map postgresql data type into your application, I assume you are using hibernate in this scenario so here is a reference link for further details.

And here other link reference you can look

Using Java arrays to insert, retrieve, & update PostgreSQL arrays

PostgreSQL Array

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM